kit: 500: Failed to fetch dynamically imported module
Describe the bug
I am encountering some issues when deploying my project to vercel using the vercel-adapter. The project builds but then the deployed site I receive 500 Failed to fetch dynamically imported module: https://xxx.vercel.app/_app/undefined
The vercel build is triggered by a new Gitlab commit.
Does someone have an idea what could cause this issue? The weird thing is that it works with npm run build
but not on the deployed vercel site…
Reproduction
This should be reproducable by using the same sveltekit + adapter versions
Logs
No response
System Info
System:
OS: Windows 10 10.0.19044
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Memory: 13.49 GB / 31.91 GB
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 97.0.4692.71
Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.55)
Internet Explorer: 11.0.19041.1202
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.10
@sveltejs/adapter-vercel: next => 1.0.0-next.36
@sveltejs/kit: ^1.0.0-next.225 => 1.0.0-next.225
svelte: ^3.46.0 => 3.46.0
Severity
blocking all usage of SvelteKit
Additional Information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 36 (7 by maintainers)
Commits related to this issue
- https://github.com/sveltejs/kit/issues/3308 — committed to jycouet/kitql-with-graphcms by jycouet 2 years ago
- https://github.com/sveltejs/kit/issues/3308 v2 — committed to jycouet/kitql-with-graphcms by jycouet 2 years ago
Hi got the latest sveltekit, got this error Failed to fetch dynamically imported module:
For me, it was an adblocker blocking some resources (i.e., there was an “ads” somewhere in the URI).
It may still happen for a few days, if users had left their tab open with a previous version of your app. Some users leave tabs open for days or weeks and this can sometimes be the case even for short lived pages such as forms or login pages.
A way to verify this sort of bugs in the future, would be to include a variable containing the version of the app in the Sentry report. This will allow to check if the error occurred with a client version that was pushed before the bug fix.
HOLY MOLY! That was it!
Having the same issue with cloudflare adapter, but just on reload.
Thanks for the update! I think I’m going to consider this issue closed. If anyone’s still running into it, please file an issue with steps to reproduce the error
For us, the issue was that we have the deployment hosted on vercel, and the proxy option turned on in our Cloudflare DNS, and Cloudflare wasn’t aware when there was a new deployment. This was causing intermittent issues that resulted in errors described in this post.
This was really hard to narrow down, but once we turned off the proxy option in Cloudflare the issues immediately cleared up.
This Cloudflare issue is actually described right in the vercel docs here: https://vercel.com/guides/using-cloudflare-with-vercel
same issue. It occurs randomly in prod environment in Chrome-based browsers, and on few couple of quick “reload” presses in firefox
I’m sorry for the delay here, but I’m happy to report I haven’t seen this error surface again. Over the past 72 hours, we’ve seen 8k page views and 47k requests.
@nikosgpet that was an excellent suggestion and one of which I will get added.
@benmccann and bumped to 260. Took me a bit longer to work through the breaking changes than I thought. We did see it a few times when testing, but things were in a crazy state of chaos. We will see what happens in the next 24.
just for reference for others that might be looking to see what changes we had to make - https://github.com/ThatConference/that.us/pull/1177
I think that this error might arise whenever you push a new update to the site, which causes a re-built of all modules. In the rebuilt, all files get a new name. If the user was already on the website and doesn’t hit rephresh, navigating in the website will eventually try to load a module that is no longer there, causing an error.
@benmccann It also happens on/with the clodflare-pages adapter