question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Service Worker registration failed with TypeError: Failed to register a ServiceWorker

See original GitHub issue

The 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

here is the repo

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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
eshtadccommented, Feb 14, 2020

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!

0reactions
eshtadccommented, Feb 14, 2020

I am able to reproduce this. Thank you for reporting. I’m looking into a fix…

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 error when trying to register serviceWorker - Stack Overflow
I get this error when trying to register the service worker: Failed to register a ServiceWorker: A bad HTTP response code (404) was...
Read more >
Failed to register a ServiceWorker - WordPress.org
Failed to register a ServiceWorker · 1) Can you please clear the server caching or if any other caching plugin is used within...
Read more >
Registering service worker - Laracasts
(index):1 Uncaught (in promise) TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.
Read more >
Error during service worker registration - Latest Master - Traccar
serviceWorkerRegistration.js:95 Error during service worker registration: TypeError: Failed to register a ServiceWorker for scope ...
Read more >
The expression cannot be converted to return the specified type
enabled is set true and Service Worker over HTTP is enabled. Actual results: Both demos fail because navigator.serviceWorker.register() generates TypeError - " ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found