question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading chunk XYZ failed

See original GitHub issue

There is a similar issue #4152, but the main difference is that I am not using a service worker just yet and it’s a static deployment, no backend serving the content. This error did not make sense to me for a long time as I was unable to reproduce it, but yesterday it finally happened.

The scenario is quite a simple, there is a deployed app using code splitting (and React.lazy) which is loaded into browser except that some chunks are not yet loaded because they weren’t needed before. If we deploy a new version later and suddenly user decides to go into the part of the app he wasn’t before, it is looking for an older chunk that’s not already there and 💥

I am wondering what is the proper solution to this. If there would be some way how to catch that error, I could force reload the app which ultimately is what needs to happen I suppose.

Honestly, I am a bit scared of registering service worker. The app is still heavy under development, but it’s already in a production. Sadly there is nothing like release calendar on the team and it’s not unusual to have 1-5 deployments to a production per week 🙄. Sometimes it’s more or less a critical fix that should be delivered to customer ASAP. Is there some strategy to essentially detect that new version has been deployed and force the service worker to reload?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
danielkczcommented, Nov 9, 2018

Alright, thank both of you for the insight. I will probably try some skeleton app first and see if it behaves the way I need. In case it won’t, I’ll reopen this.

0reactions
Timercommented, Nov 9, 2018

Oh, derp. Sorry @FredyC I totally misread this. I thought you were using the service worker – your first sentence clearly states otherwise. 😅 Sorry for roping you in, @jeffposnick!

I think this is a perfect scenario for turning on the service worker (because it solves this problem). You should be able to listen for an update event and prompt the user to force reload, manually overriding skip waiting (I think you can do this).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading chunk XYZ failed (cont.) · Issue #6243 - GitHub
Its weird because I can see that its caching the right resources but that first refresh uses the old build's index.html for whatever...
Read more >
reactjs - ChunkLoadError: Loading chunk XY failed.
I suspect that in this case, there is a production deploy after the index is loaded by the browser, and some of the...
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
Whenever there's an error observed in dynamically fetching helper JavaScript files known as Chunks, a ChunkLoad Error is thrown.
Read more >
Server Chunk Loading Error - Support - Minecraft Forum
There are black chunks in the shape of a square surrounding the server's map. They won't load and when you go there it...
Read more >
Commands/forceload - Minecraft Wiki - Fandom
Force chunks to load constantly or not, forceload add , forceload query and forceload remove are three separated commands.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found