Mobile iOS Safari Errors - 500: Importing a module script failed.

See original GitHub issue

Describe the bug

I recently migrated my website from NextJS to SvelteKit.

Everything has worked smoothly except for mysterious errors that seem to happen mostly on mobile iOS Safari, but also on desktop Firefox.

On Safari, the error is: “500: Importing a module script failed.” On Firefox, the error is: “500: error loading dynamically imported module”

Screenshot 2022-06-15 at 16 26 18

As you can see, this is so common that a total of 0.6% of visitors are getting a critical error that is severe enough to replace the entire page’s content with an error message.

On Safari, the error happens mostly on the home page. On Firefox there is no noticeable pattern. It appears to be a client-side error because my Vercel server logs are not picking up the errors.

I track the error by sending a custom event to Plausible Analytics in the __error.svelte file.

The error appears to be coming from up-to-date browser versions. As in, Safari 15 and Firefox 101.

Here’s the spike in errors after switching to SvelteKit:

Screenshot 2022-06-15 at 16 34 13

Unfortunately, I am totally unable to replicate the error myself. It does not show up on my iPhone or the versions I tested with Browserstack. And there doesn’t appear to be any stack trace provided to help me debug the issue.

This is my site: https://stockanalysis.com/ This is the repo: https://github.com/stockanalysisdev/stock-analysis-sveltekit

Has anyone dealt with this issue before? Or have an idea about the best way to debug the issue without being able to reproduce it myself?

Also, if anyone could try visiting my home page on mobile iOS Safari and see whether they get an error and a stack trace then that would be incredibly helpful.

Reproduction

Unable to reproduce testing on my own iPhone or via Browserstack.

Logs

No response

System Info

All packages have been updated to their latest versions.

System:
    OS: macOS 12.4
    CPU: (10) x64 Apple M1 Pro
    Memory: 333.49 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 17.9.0 - /usr/local/bin/node
    npm: 8.8.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 102.1.39.122
    Chrome: 102.0.5005.115
    Firefox: 101.0.1
    Safari: 15.5
  npmPackages:
    @sveltejs/adapter-auto: 1.0.0-next.50 => 1.0.0-next.50 
    @sveltejs/kit: 1.0.0-next.350 => 1.0.0-next.350 
    svelte: ^3.48.0 => 3.48.0

Severity

blocking an upgrade

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kristjanmarcommented, Jul 22, 2022

I’m going to close this since the error rate has gone down significantly. It’s down to about 0.3% of visits, which is significant but not much higher than it was with NextJS.

I haven’t done anything specific that I belive can explain the drop in errors. They increased with Vite 3.0.0 but have gone down as of Vite 3.0.2. Not sure if that’s even related to the errors.

0reactions
petermakeswebsitescommented, Nov 14, 2022

I don’t mean to beat a dead horse here, but my application is a PWA Svelte (but not SvelteKit) and getting these errors reported. I would imagine this may be still present in SvelteKit, but the reason I’m posting here is because a lot of my users are experiencing this error and I have no strings to pull on except in this thread. Does anyone understand why this is happening? Has anybody found a solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6 module fails on Safari mobile (iOS14.6) - Stack Overflow
I found the issue: the following library broke the JS execution in Mobile Safari as soon as a call was done to console.log...
Read more >
Safari gives error 500 when opening Google Search page
Go to Safari > Preferences, then click Extensions. Deselect the extension's checkbox to remove it. Restart Safari then see if that resolves 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 >
import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >
How I solved and debugged my Webpack issue through trial ...
import React from 'react';import { render } from ... If we try to backtrace the origin of the error from our Google Chrome...
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