Thanks for the last answer, one more comment that I needed to make it work for me in production as well.
Firebase is expecting a firebase-messaging-sw.js file to function as a service worker, but you are actually appending your firebase sw to the CRA serviceworker.js in your production build.
So you will have to let firebase messaging know that the serviceworker was registered else where by passing your serviceworker registration to the getToken() method when you call it.
Interesting. I wonder how I had it working then without passing that in (some kind of version discrepancy maybe?). Thanks for pointing it out! I'll include it in the post.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the last answer, one more comment that I needed to make it work for me in production as well.
Firebase is expecting a firebase-messaging-sw.js file to function as a service worker, but you are actually appending your firebase sw to the CRA serviceworker.js in your production build.
So you will have to let firebase messaging know that the serviceworker was registered else where by passing your serviceworker registration to the
getToken()
method when you call it.Interesting. I wonder how I had it working then without passing that in (some kind of version discrepancy maybe?). Thanks for pointing it out! I'll include it in the post.