Unable to register the default service worker


I am trying to develop push notifications for my website (Angular).  I am following the documentation available at comet chat pro. When I am trying to run this in browser using ng serve

I am getting below error:
( Error Occurred FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope (‘http://localhost:4200/firebase-cloud-messaging-push-scope’) with script (‘http://localhost:4200/firebase-messaging-sw.js’): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration) )

I downloaded firebase-messaging-sw.js available in github and placed in root folder under index.html. Still I am getting the above error. Can you please help me to solve this issue.

Thank you

Hello @wikikids

Apologies for the delay in getting back to you.

We will need more details for looking into this. Can you please help us with the folder structure or code snippets that will help us to investigate further?

Also, have you checked this thread on StackOverflow?


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.