renderer.domElement.toDataURL() returns transparent image with headless-gl but works in browser

I am trying to create a node.js endpoint which creates a PNG out of a scene. When running this in a browser all is well but using the same code with headless-gl creates a totally transparent image. What am I missing?

Also, I couldn’t figure out how to make a code box, that’s why I used images instead. How does one make a code box in the topic?

Skärmavbild 2021-02-22 kl. 13.42.18

Better to share you code as a GitHub repository. In this way, it’s easier for the community to download and test the project.

Link to repo: GitHub - Hankybree/HeadlessImageServer

I’ve tried to start your app via npm i && npm start but get this runtime error:

TypeError: THREE.Scene is not a constructor

Do I need a special node.js version for your project? I’m currently using 14.6.0.

Hmm, that’s weird. I run version 14.15.1