mswjs / msw

Seamless REST/GraphQL API mocking library for browser and Node.js.
https://mswjs.io
MIT License
15.28k stars 479 forks source link

Error: [MSW] Failed to locate the Service Worker registration. #2163

Open radiantone opened 1 month ago

radiantone commented 1 month ago

Prerequisites

Environment check

Browsers

Chromium (Chrome, Brave, etc.)

Reproduction repository

...

Reproduction steps

...

Current behavior

In my webapp, msw service worker loads fine most of the time, but if I reload the app, check the console, and reload it a few times in a row, the error shows up intermittently. I checked loading the serviceworker script in chrome (served from NGINX btw) and never showed any problem reaching or loading the script.

Expected behavior

To load the service worker script without claiming it failed to locate it.