Operating System
Windows 11
Browser Version
Chrome Version 121.0.6167.86
Firebase SDK Version
10.7.2
Firebase SDK Product:
Analytics, Messaging
Describe your project's tooling
Looking for Initialize Push Notifications
Describe the problem
In the React app version 18.2.0 & Node 20.10.0, I am attempting to implement push notifications. After initializing the Firebase console and requesting notification permission from the browser, I encountered the following error. I have already added the firebase-messaging-sw.js file to the root folder.
An error occurred while retrieving token. 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).
Steps and code to reproduce issue
I am attempting to implement push notifications. After initializing the Firebase console and requesting notification permission from the browser, I encountered the following error. I have already added the firebase-messaging-sw.js file to the root folder.
Operating System
Windows 11
Browser Version
Chrome Version 121.0.6167.86
Firebase SDK Version
10.7.2
Firebase SDK Product:
Analytics, Messaging
Describe your project's tooling
Looking for Initialize Push Notifications
Describe the problem
In the React app version 18.2.0 & Node 20.10.0, I am attempting to implement push notifications. After initializing the Firebase console and requesting notification permission from the browser, I encountered the following error. I have already added the firebase-messaging-sw.js file to the root folder.
An error occurred while retrieving token. 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).
Steps and code to reproduce issue
I am attempting to implement push notifications. After initializing the Firebase console and requesting notification permission from the browser, I encountered the following error. I have already added the firebase-messaging-sw.js file to the root folder.