-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
App Router: Application crashes with client-side exeption on dynamic import failure #63918
Comments
Looking at the call stack, it seems like the error comes from here: And when stepping through the code, the last line I could get to was the |
Changing |
@john-subba I'm not sure what you're asking, but I think your issue might be different and related to #64386 |
@TxHawks while using next/dynamic this appears in your page source. I mean to ask does this appear in your website page source too?. |
You can look at the reproduction code here: https://github.com/Txhawks/missing-chunk-error And at a deployed version of it here: https://missing-chunk-error.vercel.app/ |
We're facing the same. Got a lot of ChunkLoadErrors in Sentry. After the dynamic imports were removed they're gone. Waiting for a fix. |
Datadog Error Tracking is also talking about the same problem. I'm using |
@pranavks we got the same on the high-load site. It's easy to reproduce this issue using the parsers like "Screaming Frog" with 25 or 35 threads (speed) + render javascript enabled. The pages will be visible in ~5 minutes as h1 -> length 0 (by sorting this column) All of them have the error like this (this is a custom error boundary to show the error message and the isolated test server) ![]() Not sure is it related to the main issue but it can't be fixed with the performance raise... |
@TxHawks you are on the right way to solve this problem, the error itself comes from import(...) function call. You can add the wrapper around the import to silent this error and give at least the one more attempt to fetch it. Here is my example for you, let me know if it helps |
Link to the code that reproduces this issue
https://github.com/Txhawks/missing-chunk-error
To Reproduce
The reproduction imports a
Foo
component usingnext/dynamic
. When the network request tofoo.js
fails, the whole app comes down crashing.201.e0005a340046428d.js
ChunkLoadError: Loading chunk 38 failed.
client-side error.This isn't limited to Vercel and can be reproduced locally with
next build && next start
as well.Current vs. Expected behavior
As explained above, any failure in loading a component with
next/dynamic
causes an error that is entirely irrecoverable in the client, and which crashes the entire app. Even Doing something like this doesn't help:Dynamic imports are susceptible to network flaws and causing of an irrecoverable client error for something like this makes applications extremely brittle.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 Available memory (MB): 65536 Available CPU cores: 10 Binaries: Node: 20.10.0 npm: 10.2.3 Yarn: 1.22.19 pnpm: 8.15.4 Relevant Packages: next: 14.2.0-canary.50 // Latest available version is detected (14.2.0-canary.50). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Dynamic imports (next/dynamic)
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
I've seen #54008, and this does seem similar, but seems to not be the same. I tried against
13.5.5
which the issue mentions, and it fails in the same way there.The text was updated successfully, but these errors were encountered: