Open MathiasWP opened 1 week ago
Weird. There shouldn't be a type error for reading universal if it is undefined since there's an optional chain operator (unless node is undefined)
EDIT: will have to look into why node
is undefined here
Would probably need more details of which route the issue was reported for and the page options affecting that (prerendered, ssr, etc)
I can only imagine this was caused by some deployed version differences such as the user trying to load or preload a route client-side but the server routes were updated because of a new deployment, so it has a different manifest, then returns an undefined node.
we might have to add an undefined check for this, but it would be great if there was more information such as stack traces
Would probably need more details of which route the issue was reported for and the page options affecting that (prerendered, ssr, etc)
I can only imagine this was caused by some deployed version differences such as the user trying to load or preload a route client-side but the server routes were updated because of a new deployment, so it has a different manifest, then returns an undefined node.
we might have to add an undefined check for this, but it would be great if there was more information such as stack traces
The only page option we have defined is export const ssr = true
. I cannot find a lot more information on the issue, the only stack-trace i can find is already in the picture i provided. Here's a screenshot of the Trace view of the issue, i hope this can help some more. It seems like the error was triggered 12.45 minutes after the app started loading:
Please let me know if there's anything more i can give you. We are using the session-store to force a reload of the page if a new version has been deployed + the vite:preloadError
event from Vite. We do this because we have seen the "failed to load dynamically imported module" error thousands of time in our app.
Note: We added the vite:preloadError
last week, which is the same time we started seeing this bug. Not sure if it's relevant, but wanted to let you know.
The only page option we have defined is
export const ssr = true
.
SSR is true by default for SvelteKit, so it's likely there is a layout introducing additional page options here. I guess the most important page option would be prerender
because if that's set to true you can check the html file to see if the hydration values were set correctly.
We are using the session-store to force a reload of the page if a new version has been deployed + the
vite:preloadError
event from Vite. We do this because we have seen the "failed to load dynamically imported module" error thousands of time in our app.Note: We added the
vite:preloadError
last week, which is the same time we started seeing this bug. Not sure if it's relevant, but wanted to let you know.
I wonder if it's linked to https://github.com/sveltejs/kit/issues/9089#issuecomment-1437042343 . The expected behaviour is that if a module fails to load, SvelteKit will do a version check and refresh the page. I'm more curious why that's not happening when your "failed to load dynamically imported module" errors occur. Do you have more information to share regarding that?
The only page option we have defined is
export const ssr = true
.SSR is true by default for SvelteKit, so it's likely there is a layout introducing additional page options here. I guess the most important page option would be
prerender
because if that's set to true you can check the html file to see if the hydration values were set correctly.We are using the session-store to force a reload of the page if a new version has been deployed + the
vite:preloadError
event from Vite. We do this because we have seen the "failed to load dynamically imported module" error thousands of time in our app. Note: We added thevite:preloadError
last week, which is the same time we started seeing this bug. Not sure if it's relevant, but wanted to let you know.I wonder if it's linked to #9089 (comment) . The expected behaviour is that if a module fails to load, SvelteKit will do a version check and refresh the page. I'm more curious why that's not happening when your "failed to load dynamically imported module" errors occur. Do you have more information to share regarding that?
I checked all the routes, and the only page option we have defined is ssr
. Our app is a highly interactive enterprise app that uses web-sockets, so the initial render is only our loading screen. Not sure how much that helps...
We recently migrated our Sentry from the US to EU, so i don't have any of the issues with the "failed to load dynamically imported module" errors, but since we started using vite:preloadError
we've finally been able to remove the issue (it of course helps that you can do e.preventDefault()
to not get the error thrown and captured, but we also know when to refresh the page). Is there a reason SvelteKit does not use vite:preloadError
?
Not sure if relevant, but we usually push code to production 3-10 times a day on the Frontend, and we have the poll-interval set to 30 seconds. We also enabled Skew Protection in Vercel, but that didn't really help.
Got another error with Cannot read properties of undefined (reading 'universal')
in Sentry, but this one had some more stack-traces:
I managed to get access to our old Sentry with the Failed to fetch dynamically imported module
error, but there's not a lot information in our Sentry dashboard on this issue... :/
Here's a screenshot of a full trace:
I remember seeing this issue once the moment a user entered the page, i was sitting right next to the user and they got the error message during our loading screen (which is within the first seconds the user visits the page).
Any status on this issue? We're getting this error at least once a day
Any status on this issue? We're getting this error at least once a day
I was planning to try and reproduce this locally if I found some spare time. It sounds like a type of cache / deployment skew issue similar to https://github.com/sveltejs/kit/issues/9089 . Definitely going to run through the code in https://github.com/sveltejs/kit/blob/main/packages/kit/src/runtime/client/client.js to see where we could handle the failed module loads better (maybe even add a handler for vite:preload if we haven't already).
Meanwhile, I'd recommend finding a temporary workaround from the others who posted similar experiences in #9089 . Sorry I can't get to this right away 🙏🏼 I try to take coding lightly on the weekends so I don't get burnt out from the coding at work too.
Are you able to share how you have implemented the vite:preloadError event listener? I'd like to try and understand what caused the Cannot read properties of undefined (reading 'universal')
error.
Are you able to share how you have implemented the vite:preloadError event listener? I'd like to try and understand what caused the
Cannot read properties of undefined (reading 'universal')
error.
Inside our app.html
file we have added the vite:preloadError
event listener like this:
<script nonce="%sveltekit.nonce%">
/**
* @see https://vitejs.dev/guide/build.html#load-error-handling
*/
window.addEventListener('vite:preloadError', (e) => {
e.preventDefault()
window.location.reload()
});
</script>
Describe the bug
We got the following alert in Sentry:
Reproduction
Not sure what is triggering this, if you give me a direction i can try to create a repro.
Logs
No response
System Info
Severity
annoyance
Additional Information
No response