DEV Community

Discussion on: PWA Push Notifications with Firebase (Cloud Messaging)-Part 1

Collapse
 
joakflores profile image
Joak

Hi, thanks for share.
I have some issues, could you help me please?

I have tried with CDN

In the line
firebase.initializeApp(config);

I have gotten the error "firebase is not defined

So, I copied the 2 files (firebase-apps.js & firebase-messaging.js into my carpet js and I have gotten the same error.

what's wrong?

Collapse
 
devpato profile image
Pato

Can you send me a link to your repo?

Collapse
 
joakflores profile image
Joak

Maybe I found the error, please give me if I'm right ....

1) This code has to be on service worker, right?
var firebaseConfig = {
apiKey: "xxxxx",
authDomain: "xxxxx",
databaseURL: "xxxxx",
projectId: "xxxxx",
storageBucket: "xxxxx",
messagingSenderId: "xxxxx",
appId: "xxxxx",
measurementId: ""
};
firebase.initializeApp(firebaseConfig);

2) Firebase seek a specific service worker name in the app? , I have one with the name sw.js, that name works?

Regards