Skip to content
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

The script has an unsupported MIME type ('text/html'). #483

Open
AllanOliveiraM opened this issue Jul 6, 2023 · 1 comment
Open

The script has an unsupported MIME type ('text/html'). #483

AllanOliveiraM opened this issue Jul 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@AllanOliveiraM
Copy link

AllanOliveiraM commented Jul 6, 2023

Summary

I caught this error on Sentry:

SecurityError: Failed to register a ServiceWorker for scope ('my_domain.../') with script ('my_domain.../sw.js'): The script has an unsupported MIME type ('text/html').

I have done extensive research and found that other people have encountered the same issue with CRA, but I'm having trouble understanding what to do with Next. I have several clients who are unable to install the PWA due to this error, mostly on mobile devices. What's interesting is that some of them are up to date and should support PWAs.

Versions

  • "next": "^13.3.4",
  • "next-pwa": "^5.6.0",
  • "react": "^18.2.0",

How To Reproduce

I couldn't reproduce it in a controlled environment. It's happening on multiple people's devices. I'm able to capture the exceptions with Sentry, and when I analyze what people are seeing on Hotjar, they're indeed unable to install the app.

Steps to reproduce the behavior:

Apparently, customers access the website, and during the script loading, the browser already raises this exception.

Expected Behaviors

It should be possible to register the service worker.

Screenshots

image

😢

Any ideas on where should I start to solve this?

@AllanOliveiraM AllanOliveiraM added the bug Something isn't working label Jul 6, 2023
@AllanOliveiraM
Copy link
Author

I found this issue
#479
Maybe?
I'm not sure if it's the same case, but there's a good chance it is.
I tried accessing the /sw.js file to see if it was there, and yes, it was. Everything works fine on the computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant