Service Worker registration failed with TypeError: Failed to register a ServiceWorker
See original GitHub issueThe error: Service Worker registration failed with TypeError: Failed to register a ServiceWorker for scope ('http://localhost:4200/%7B%7BROOT_URL%7D%7D') with script ('http://localhost:4200/%7B%7BROOT_URL%7D%7D%7B%7BSERVICE_WORKER_FILENAME%7D%7D'): A bad HTTP response code (404) was received when fetching the script.
My application is not able to register the serviceworker and I am receiving the error that it’s not finding the sw.js file. I created a new project and installed all the dependencies for making the website a pwa, just to check if my application was the fault and i still received the error with the ember welcome page app
I looked at the sw-registration.js file and found this
navigator.serviceWorker.register('{{ROOT_URL}}{{SERVICE_WORKER_FILENAME}}', {
code part which might cause this error, since it doesn’t find the sw.js file
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Looks like this is caused by version 2.3.1 of
@rollup/plugin-replace
which was released 13 days ago. It’s a dependency upgrade and I haven’t nailed down the full case yet. In the meantime, we peg our dependency here until it is sorted out. Thanks all for reporting!I am able to reproduce this. Thank you for reporting. I’m looking into a fix…