codesandbox / sandpack

A component toolkit for creating live-running code editing experiences, using the power of CodeSandbox.
https://sandpack.codesandbox.io
Apache License 2.0
4.52k stars 310 forks source link

Service Worker registration failed (text/html) #1068

Open luwes opened 5 months ago

luwes commented 5 months ago

Bug report

Packages affected

Description of the problem

console is showing an error since version 2.11.0

Service Worker registration failed: DOMException: Failed to register a ServiceWorker for scope ('https://2-11-2-sandpack.codesandbox.io/') with script ('https://2-11-2-sandpack.codesandbox.io/csb-sw.js'): The script has an unsupported MIME type ('text/html').

SCR-20240125-pokw

Pinning both the client and react pkg to 2.10.0 fixed the issue on our end.

Used here https://github.com/muxinc/media-chrome/pull/791

Repro here, error visible in the console https://media-chrome-docs-a1ftyhecw-mux.vercel.app/docs/en/get-started

binghuis commented 4 months ago

+1

binghuis commented 4 months ago

I've tried several times and have found a temporary solution for now. You can still use the latest version of @codesandbox/sandpack-react, but you'll need to additionally configure the package.json file, fixing the version of the @codesandbox/sandpack-client package at "2.10.0". I suspect that the issue is caused by the @codesandbox/sandpack-client package as it uses an independent version number and doesn't stay in sync with @codesandbox/sandpack-react, which depends on it. Therefore, the latest version of @codesandbox/sandpack-client directly causes the page to throw an error.

binghuis commented 4 months ago
image
hariria commented 2 months ago

Facing this issue (same as @binghuis screenshot) still on "@codesandbox/sandpack-react": "^2.13.10"

Molnfront commented 1 month ago

Same error for latest version and whatever I do it still try to use: https://2-13-8-sandpack.codesandbox.io/

did not help to use resolutions

DUDY206 commented 3 weeks ago
image

It's work for me. Many thanks

jsartisan commented 1 day ago

It worked for me after i hosted the bundler at a subdomain. My domain is https://frontend-challenges.com/ and I hosted the bundler at https://bundler.frontend-challenges.com