sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Service Worker registration failed (text/html)

Open luwes opened this issue 1 year ago • 6 comments

Bug report

Packages affected

  • [x] sandpack-client
  • [x] sandpack-react

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

luwes avatar Jan 25 '24 23:01 luwes

+1

binghuis avatar Feb 05 '24 06:02 binghuis

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 avatar Feb 19 '24 08:02 binghuis

image

binghuis avatar Feb 19 '24 08:02 binghuis

version:2.13.5 image

binghuis avatar Feb 29 '24 11:02 binghuis

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

hariria avatar May 01 '24 01:05 hariria

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

Molnfront avatar Jun 01 '24 20:06 Molnfront

image

It's work for me. Many thanks

DUDY206 avatar Jun 06 '24 09:06 DUDY206

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

jsartisan avatar Jun 30 '24 17:06 jsartisan

It has been fixed in the latest version. Sorry for the long wait!

danilowoz avatar Jul 03 '24 13:07 danilowoz