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

Closed
aldarund opened this Issue May 29, 2018 — with CMTY · 12 comments

Comments

Projects
Copy link
Member

aldarund commented May 29, 2018 — with CMTY

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

This bug report is available on Nuxt.js community (#c7171)

@cmty cmty bot added the cmty:bug-report label May 29, 2018

@lucasmpaim

This comment has been minimized.

Copy link

lucasmpaim commented Jun 18, 2018

Any update on this?

@aldarund

This comment has been minimized.

Copy link
Member Author

aldarund commented Jun 18, 2018

@lucasmpaim you can use workaround like this for now -> #742 (comment)

@Atinux

This comment has been minimized.

Copy link
Member

Atinux commented Aug 6, 2018

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 :)

@qm3ster

This comment has been minimized.

Copy link
Collaborator

qm3ster commented Aug 20, 2018

@Atinux what are you talking about, "hard-reload" 😱
Only seamless hotModuleReloading without memory leaks and with Vuex migration!

@amorino

This comment has been minimized.

Copy link

amorino commented Sep 18, 2018

Any update on this?

@ahus1

This comment has been minimized.

Copy link

ahus1 commented Oct 20, 2018

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.

    mounted: function () {
      if (this.error.statusCode === 500
        && /^Loading chunk [0-9]+ failed/.test(this.error.message)
        && window.location.hash !== '#retry') {
        // the chunk might no longer be available due to a recent redeployment of the page
        // mark the page to don't trigger reload infinitely
        window.location.hash = '#retry'
        window.location.reload(true)
      } 

Comments to improve the workaround are welcome!

@stale

This comment has been minimized.

Copy link

stale bot commented Nov 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Nov 10, 2018

@stale stale bot closed this Nov 17, 2018

Bugs 🐞 automation moved this from Open to Fixed Nov 17, 2018

@pi0 pi0 reopened this Nov 17, 2018

Bugs 🐞 automation moved this from Fixed to Open Nov 17, 2018

@stale stale bot removed the stale label Nov 17, 2018

@sumeshkmp

This comment has been minimized.

Copy link

sumeshkmp commented Dec 5, 2018

Have seen this issue on V2.2.0

@magisters-org

This comment has been minimized.

Copy link

magisters-org commented Dec 8, 2018

Up, one more.

@josepjaume

This comment has been minimized.

Copy link

josepjaume commented Jan 22, 2019

This is definitely an issue.

@purpleow1

This comment has been minimized.

Copy link

purpleow1 commented Feb 8, 2019

Is this issue fixed in version 2.4.0?

@ahus1

This comment has been minimized.

Copy link

ahus1 commented Feb 8, 2019

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment