-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Website fails to load completely #3582
Comments
It's related to https://www.gatsbyjs.org/docs/caching/#javascript The gatsby-plugin-offline SW is caching JS so sometimes this means that a module will change internally but its name won't so things break... :-( Gatsby v2 (working on this now) which upgrades us to webpack 3 will solve this. I'd kinda forgotten about this issue w/ the offline plugin. The solution there is we shouldn't cache JS files either. Would you like to put together a PR for that? We can re-enable JS caching in the SW for Gatsby v2. |
@KyleAMathews Could it be solved if a parameter is on requests append like |
I had the same error. I believe it is because the window.webpackManifest is written to the bottom of the body. So sometimes it is not initialized, when the components script are loaded and trying to access it. my html.js looks like this
I'm aware this in an ugly hack, but I'm not familiar with the gatsby code base to actually make a PR. |
@Dotmagic yes but that's worst as then scripts would need downloaded every time. Better to force 301 validations as that's far faster/cheaper. |
Though harder to do with SW sigh Let's just get Gatsby v2 out ASAP which will fix this for realz. |
Hi @KyleAMathews ! I'm encountering the same issue and I didn't see the fact that JavaScript files shouldn't be cached for now. So my users are stuck with some erroneous files because I set Is there a quick way to specify a parameter like @Dotmagic suggested before? Thank you! |
@julien1619 not easy unfortunately — best bet is to post-process HTML files and add the query string programmatically to the script tags. You could use something like https://www.npmjs.com/package/cheerio in Gatsby's |
@KyleAMathews Thank you! Finally, I did a more manual change: I replaced all |
Just ran into this issue also so I disabled SW caching for now :( |
@zanedev what options did you use to disable caching within the plugin? |
Sorry I mean I removed the offline plugin temporarily until it’s all fixed |
That's what I ended up doing too. I'll revisit once v2 is official. |
@lightstrike @zanedev did you need to do anything to unregister the already existing SW? |
@pedrouid I did unfortunately and I didn't realize it until after I had released new features and everyone was freaking out. Not a fun position to be in :) This article helped me figure out how to clear them (near the bottom) |
@zanedev Thanks! That worked perfectly |
If caching doesnt work - you should remove it completely from your site and warn against using it - this is terrible. Just took me about 5 hours of staring at my css like wtf why arent these classes even on this div at all until I realized this. I would point out to anyone here you probably need to manually remove your service worker or your users will just see empty content after you remove the offline plugin if (typeof navigator !== 'undefined') {
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations) {
registration.unregister();
}
});
} PSCan you guys try to use Webpack 4 not 3 ? Or better yet just wait until 5 and release up-to-date. If releasing v2 on an already old version of webpack that will be insanely behind since Webpack 5 is about to ship; |
@bradennapier sorry you had trouble with this, Gatsby v2 is actively being worked on with the aim of getting v2 betas out as quickly as possible. Until then, note that there's |
@m-allanson thanks!! Awesome good to hear you guys are updated to wp4 already. Appreciate the response. Great work on the overall solution - love Gatsby! |
I am having the same issue, but getting this error: It happens about 15% of the time and the error goes away after reloading the page ~3 times. Is it the same problem as above? Is there anyway to fix this right now? This is my gatsby-config.js file:
The problem only happens on the production build. I opened an issue: #6947 |
I experienced similar happenings..I'm still on my way preparing to release my upgrade to v2 and don't know if this might also fix this? Anyone knows? |
@CanRau see #3582 (comment), normally webpack v3 fixes it, so yes Gatsby v2 should fix it. (I haven’t upgraded yet) |
thanks for the hint..I guessed it might be fixed but good to read it ;) |
@sedubois can you try upgrading gatsby and dependencies to their latest stable versions? We released version 2 recently, that might solve the issue for you. |
@kakadiadarpan I propose to close this and will reopen if I encounter issues. (I had to move away from the codebase used in the OP; I will update it to v2 and push to production when possible.) |
Hi Guys! When I run Building static HTML for pages{ Error: Cannot find module '!raw-loader!../public/styles.css'
|
Hey @madhusudhan1234 sorry for the late response, were you able to figure it out? |
I have the same problem, production build fails. Worked fine just recently, maybe related to some package updates? |
This is occuring on my site right as I used it to demo. Not good man. Not good at all. |
Description
Since I started using Gatsby a couple of months ago, I regularly get issues when visiting the published site. No issue in local development. The issue gets fixed when hitting Ctrl-Shift-R, but I can hardly expect all my visitors to do this every time...
I just see this error in the console:
The
bootstrap%2003bd3a01b7024eecaa93:52
file shows this:This is in a file whose description is
// install a JSONP callback for chunk loading
.Is this something to do with chunk loading which breaks because of gatsby-plugin-offline? My setup is very similar to the gatsbyjs.org codebase, so I think that the Gatsby site has the same issue, as I reported previously in #3142.
Do you have any idea of the underlying cause and the proper way to fix this? If there's no proper fix, is there a workaround such as disabling service worker entirely?
Unfortunately chunking and caching are still way above my skillset, but this is directly impacting our visitors.
Environment
Gatsby version: 1.9.158 and all my packages/plugins are up to date
Node.js version: v8.9.4 (npm v5.6.0)
File contents (if changed):
gatsby-config.js
:package.json
:gatsby-node.js
:gatsby-browser.js
: not changedgatsby-ssr.js
: not changedActual result
The page only loads partially. Presumably, the browser only loads some cached assets but doesn't initialize Javascript properly. Visually the main image will remain blurred instead of loading fully. Or even the first redirect (from
/
to/en
) might also fail, so it doesn't load the content at all. This happens with my Firefox browser but also observed on my Chrome.Expected behavior
Page shouldn't fail to load.
Steps to reproduce
Happens regularly (but not always) when I deploy. Please let me know if there's something else I can provide to investigate.
Thanks a lot for your time and keep up the good work!
The text was updated successfully, but these errors were encountered: