1

I'm new in ngsw and firebase and I have question, I have angular 6 app with base href='/test/' and I'm trying to connect this app with fcm and ngsw but I notice one issue: when I trying to get messaging.getToken() I got error 404 (that it can't find messaging/failed-serviceworker-registration - because it's in /test/...). I made combined-worker.js that combine ngsw-worker and firebase-messaging-sw.js so that two workers are working.

Please let me know it you have any solution

const firebaseConfig = {
  messagingSenderId: "xxx"
};
firebase.initializeApp(firebaseConfig);


const messaging = firebase.messaging();
messaging.requestPermission()
  .then(()=> {
    console.log('sub');
    return messaging.getToken();  //error :(
  }).then(token => {
    console.log('token', token);
  }).catch(err => {
    console.error(err);
  })
foczki
  • 125
  • 8

0 Answers0