When the selected node to generate the image for is a `<g/>` tag the function fails with the error below:  See here: https://stackblitz.com/edit/vitejs-vite-w1wbjqmw