Error creating WebGL context
Bug Report 🐛
I have trouble with remotion and three js, in dev mode everything is ok, but when I am trying to render via CLI I get an error - Error creating WebGL context. I tried in Docker on server and locally on Mac Book. When I am using remotion without ThreeCanvas , everything is ok.
An error occurred while rendering frame 1: Error Error creating WebGL context.
It's also repeat with this example - https://github.com/remotion-dev/template-three
Thanks for reporting! Looks like a recent Chrome version broke it.
You need to add
Config.Puppeteer.setChromiumOpenGlRenderer('angle');
to your remotion.config.ts file to fix it - I added it to the template now and made a PR in Remotion to give better error handling for it.
Problems:
- This broke rendering in GitHub Actions, so reverted
- Did not work inside Docker
Therefore this change is reverted now
First investigation shows that the reason for it is that some slim Docker images do not have graphics capabilities. A special Docker image which has the necessary libraries will be required for sure
@JonnyBurger Could you specify which libraries are needed to prevent this error message in docker? Or are you still looking into it?
I've now created a working Dockerfile: https://remotion-git-docker-remotion.vercel.app/docs/docker
I know that macOS is broken by default, but there seems to be no value that works everywhere - I added the recommendation to use angle in case you get the render error.
Hi,
webgl seems to be still missing when exporting a video, even when adding
Config.setChromiumOpenGlRenderer('angle'); to the config or --gl angle with lambda.
@JonnyBurger Do you have an idea on how to fix this?
TLDR: canvag.getContext("webgl") returns undefined in export, but works in player
On Lambda, I would recommend not setting any GL option, so null.
As far as I remember, the context will not be null then!
You're right! Not setting any GL option fixed the problem. Thanks @JonnyBurger !