You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('http://localhost:5173/firebase-cloud-messaging-push-scope') with script ('http://localhost:5173/firebase-messaging-sw.js'): ServiceWorker script evaluation failed (messaging/failed-service-worker-registration).
at registerDefaultSw (registerDefaultSw.ts:43:25)
at async updateSwReg (updateSwReg.ts:28:5)
at async getToken$1 (getToken.ts:43:3)
** firebase-config-sw.js file in root folder
code snippet
firebase-config-sw.js
import { initializeApp } from "firebase/app";
import { getMessaging, getToken } from "firebase/messaging"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('http://localhost:5173/firebase-cloud-messaging-push-scope') with script ('http://localhost:5173/firebase-messaging-sw.js'): ServiceWorker script evaluation failed (messaging/failed-service-worker-registration).
at registerDefaultSw (registerDefaultSw.ts:43:25)
at async updateSwReg (updateSwReg.ts:28:5)
at async getToken$1 (getToken.ts:43:3)
** firebase-config-sw.js file in root folder
code snippet
firebase-config-sw.js
import { initializeApp } from "firebase/app";
import { getMessaging, getToken } from "firebase/messaging"
const firebaseConfig = {
apiKey: "",
authDomain: ".firebaseapp.com",
projectId: "***",
storageBucket: ".appspot.com",
messagingSenderId: "",
appId: "1::web:",
measurementId: "****"
};
async function requestPermission() {
console.log('Requesting permission...');
await Notification.requestPermission((permission)=>{
if (permission === 'granted') {
console.log('Notification permission granted...');
const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app)
requestPermission()
///////////
<script type="module" src="/dev-dist/registerSW.js"> </script> <script type="module" src="/firebase-messaging-sw.js"></script>index.html (root folder)
Beta Was this translation helpful? Give feedback.
All reactions