Gatsby ssr broken on netlify "Can't resolve 'canvas'"
See original GitHub issueHi i’m using the pdf viewer for create a website with Gatsby hosted on netlify but all my github actions for netlify come back failed.
- Web browser and its version: Firefox dev edition version 89
- Operating system and its version: macOS Big Sur version 11.2.3
- PDF.js version: “version”: “2.5.207”,
- Is a browser extension: no
i have read the log and found this
10:40:14 AM: Can't resolve 'canvas' in '/opt/build/repo/js/node_modules/pdfjs-dist/build'
10:40:14 AM: If you're trying to use a package make sure that 'canvas' is installed. If you're trying to use a local file make sure that the path is correct.
10:40:14 AM: not finished Caching JavaScript and CSS webpack compilation - 15.502s
10:40:14 AM: not finished Building HTML renderer - 15.441s
10:40:14 AM: not finished Caching HTML renderer compilation - 0.384s
I wonder if someone here could explain me what canvas is for thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Gatsby Site Can't Resolve - Netlify Support Forums
Hi @perry it looks like it's related to this issue, but I was able to fix it by clearing cache and retrying the...
Read more >Gatsby Build Error while deploying - Netlify Support Forums
Hello I'm running to this issue on Netlify when it's executing the 'Gatsby Build' command, while on localhost everything is running smooth.
Read more >Gatsby 5 upgrade error - Netlify Support Forums
The problem is that, our build system currently does not support build plugins with Node 18 and Gatsby 5 doesn't support Node 16....
Read more >Run Gatsby 4 with DSG and SSR on Netlify today
It seems that Gatsby has broken free of its static-site generator (SSG) roots and is embracing server-side rendering. In addition to SSG, ...
Read more >How to use Fabric in Gatsby? - Stack Overflow
It seems that fabric is using a global object (such as window or document ) to make their stuff. gatsby develop is compiled...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@yordis Yeah i figured out this you just have to add inside a gatsby-node.js this code gonna block the loading of those package during the build because they dont have any window to refer to. When the site gonna be loaded and render to the dom they gonna load and have a window to refer so the error gonna be gone ! For every package who block you the ssr because of a
window not defined
just add this !I have the same issue but with Next.JS deployment on Netlify. By adding next.config.js… it works for me.