firebase / firebase/quickstart-js
Messaging: We are unable to register the default service worker.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 3.7k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 6
Description
I'm trying to add Firebase Cloud Messaging to a simple static site with vanilla Js. The notifications seem to be working in localhost(i.e serve . But when I deploy to GitHub Pages it causes the following error
Console:
`FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('https://sample.github.io/firebase-cloud-messaging-push-scope') with script ('https://sample.github.io/firebase-messaging-sw.js'): A bad HTTP response code (404) was received when fetching the script. (messaging/failed-service-worker-registration).
at rt. (https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js:1:31316)
at https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js:1:1935
at Object.throw (https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js:1:2040)
at i (https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js:1:834)`
Contributor guide
Assessment
This issue has not been assessed yet.