-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[edge] Deployment of new version breaking site for live users. ( Loading chunk {n} failed error) #3389
Comments
Any update on this? |
@lucasmpaim you can use workaround like this for now -> #742 (comment) |
Everytime you will rebuild your app, some filenames will change, the solution is to push your bundle to a CDN to avoid having not found file which lead a a chunk error. We may try to find a solution to hard-reload the page when this error happens, any PR attemps will be really appreciated :) |
@Atinux what are you talking about, "hard-reload" 😱 |
Any update on this? |
For now I use the following workaround by adding this to the error template: it will reload the page. The user will be again on the page where she/he started the navigation. She/he can then retry the interaction. It adds a hash to the URL to avoid infinite reloads. The hash will be automatically removed on the next successful navigation. This will might work for you as well until #3940 is released. Tested with Nuxt 2.2, but should work with earlier versions as well.
Comments to improve the workaround are welcome! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Have seen this issue on V2.2.0 |
Up, one more. |
This is definitely an issue. |
Is this issue fixed in version 2.4.0? |
yes (i tried it, the nuxt SPA will reload once it doesn't find a JavaScript resource it tries to load. This way it will load the most recent app from the server that will have all needed resources available) |
I'm experiencing this on Nuxt version 2.4.5, but only in development. |
Currently experiencing this live on 2.4.5 Previously, I had used this error/refresh solution But this no longer seems to work? I'm simply having errors logged about chunks again, and I can't seem to get this working. On the topic of putting nuxt files on a CDN..., how would that work with globally distributed lamdas like now.sh? |
@robyedlin Ideally, Nuxt can load all chunks into the browser's cache so that the user doesn't need to reload the page. There might be a service worker in the background that checks the new version and pushes a notification to the user to reload the page in order to update to the latest version. In fact, there are few apps that follow this approach. See https://medium.com/progressive-web-apps/pwa-create-a-new-update-available-notification-using-service-workers-18be9168d717 |
@buremba This is actually how nuxt @Atinux what do you think about a universal mode config option that allows downloading all js chunks async on first page load, similar to the way it works in spa mode? This would mitigate almost all loading chunk errors. |
I did not know about the PWA before, just started experimenting it for this use-case. Couldn't find any relevant information here though. https://pwa.nuxtjs.org/ |
I kind of fixed this in the past by checking for a version file containing the SHA of the latest commit in the background, and then setting an Ugly hack, but it worked. Sure there's better ways to do this though. |
OK so files starting with |
@garineGiftagram why do you need to call your routes starting with . ? |
@AndrewBogdanovTSS chunks/code splitting are created by my dynamic routes. Check my stackoverflow Question |
@garineGiftagram from the link I understood that the problem is not in generation but in the filename, there shouldn't be cases when your file don't have a name. You could at least put cache in front of it. Did you find what was causing empty names issue? |
@AndrewBogdanovTSS even when I change the filename settings in the config , this one particular file did not get updated. whatever I did, I just got |
This workaround is not working because layouts/error.vue is not rendered. |
@pi0 is it possible to get this issue reopened? |
@khangal Please let me know if you find a workaround :) |
I received this same error on production build as well. Wanting to know if there's a good fix for this. |
Hi. It is expected that #3940 to be working and trigger a hard reload if a chunk is missing. Do you mind opening a new issue (with proper steps to reproduce) describing in what situation error can't be handled? |
@pi0 As I understood you fixed chunk errors only for css files. Did you have a reason for this ? Cause right now I have an error with js files with I thought to add a reload for js chunks files or try to keep all chunks from the previous 1-2 releases. |
still happening on nuxt 2.14.7 |
Has this been fixed? I keep getting the same error |
Do you have any update on this topic? we had to put in place a terrible workaround in order to avoid this situation. |
We discovered that in our case the problem was the cache expiration time from cloudfront when serving the nuxt static build from amazon S3. When we changed the cache expiration time to 0 if i'm not wrong, the problem went away forever. Best regards |
Just FYI, we were experiencing the same issue and found an article listing all the possible workarounds: We will most likely go with the Websocket way on our end, but the Cache approach would work as well unless you have a time-sensitive update to deploy. |
Thanks @guska8 for the solution. I fixed my problem on CloudFront as well. Let's me share it in details here. Context: Route53 -> CloudFront -> EC2 Application Loadbalancer -> ECS (Fargate) <- ECR <- CodePipeline <- Github Problem: Based on @Bruno-Meowtel website above, this should not be an issue because I have a CDN (CloudFront here). But by default, CloudFront has a setting of Solution: Setting MinTTL to a large number fixes my issue. In particular, I have the following CloudFront setup: I only cache the assets folder of my Nuxt.js app and disable caching of the pages:
The HashedAssetsCache policy is a customized policy with a large Minimum TTL. |
Version
v1.4.0
Reproduction link
None
Steps to reproduce
This happens on a live site, production deployed not a dev. The sequence of events following:
User opened the site home page
New version of the app was deployed to web servers
User clicked a link to another page within the nuxt SPA
User saw Loading chunk {n} failed message instead of the new page content
https://i.imgur.com/AO7gX9h.png
Any site deploy could break the SPA for live users and cause them to need a refresh.
This should be handled properly by nuxt, maybe something like automatically refresh in such cases. This is just really frustrating and bad behavior for users
What is expected ?
No error displayed to user. Site autoreload or whatever will work here
What is actually happening?
User see some cryptic error
Afaik nuxt 1.4 have same behaviour
The text was updated successfully, but these errors were encountered: