Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL context cannot be created #392

Open
rohan-deshpande opened this issue Jul 11, 2019 · 6 comments
Open

WebGL context cannot be created #392

rohan-deshpande opened this issue Jul 11, 2019 · 6 comments
Labels

Comments

@rohan-deshpande
Copy link

rohan-deshpande commented Jul 11, 2019

Bug Report

Note I'm using v1.10.0 because I kept getting #240
My react-scripts is v2.1.8

Current Behavior
THREE.WebGLRenderer: Error creating WebGL context.

Reproducible demo
here

Expected behavior/code
react-snap should build the static site without error

Possible Solution
Use react-snapshot which works without error, but it isn't really supported anymore it seems.

Additional context/Screenshots

  / log: THREE.WebGLRenderer
✏️  / log: THREE.WebGLRenderer: Error creating WebGL context.
function) [as next] (http://localhost:45678/static/js/2.a2538651.chunk.js: Error: only absolute urls are supported
🔥  / pageerror: Error: TypeError: Cannot read property 'getShaderPrecisionFormat' of null
@stereobooster
Copy link
Owner

I guess there is an issue with puppeteer and headless chrome. Maybe this one https://stackoverflow.com/a/48063721/1190041?

@rohan-deshpande
Copy link
Author

Hmm, okay! Thanks for the link. What a shame, maybe that is fixed in a later version (since I'm using 1.10.0, but I can't upgrade because of #240 - Are there any reasons why you think that might be happening?

@stereobooster
Copy link
Owner

I have not much insights than this. You may post issue in puppeteer repo

@rohan-deshpande
Copy link
Author

rohan-deshpande commented Aug 13, 2019

I'm wondering if I can use some sort of environment variable to stop it from entering the WebGL codepath when running postbuild because really, I don't need it to attempt to try to do this when snapshotting. As long as when the site is accessed and the WebGL context can be created, things should be fine.

@stereobooster
Copy link
Owner

navigator.userAgent === 'ReactSnap' may help

@rohan-deshpande
Copy link
Author

This did the trick! Thanks very much. Not sure if the bug should be closed because the error still happens, but maybe it's a Puppeteer issue. Might be handy to document it in the README perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants