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
Google Chrome Version 120.0.6099.199 (Official Build) (arm64)
Firebase SDK Version
9.22.0
Firebase SDK Product:
Messaging
Describe your project's tooling
React app with Webpack
Describe the problem
I've been seeing these errors in sentry for a while, they come from service worker file even if I register service worker only if isSupported() passes.
This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc) (messaging/indexed-db-unsupported).
So I decided to do the same check in service worker but I'm getting these warnings if I call getMessaging asynchronously after isSupported() is resolved (see the screenshot)
Event handler of 'push' event must be added on the initial evaluation of worker script
Event handler of 'pushsubscriptionchange' event must be added on the initial evaluation of worker script.
Event handler of 'notificationclick' event must be added on the initial evaluation of worker script.
Can you please confirm my approach with calling getMessaging asynchronously only if isSupported is correct ? If not what is the correct way using isSupported in service worker to prevent getting the error mentioned at the beginning ?
Steps and code to reproduce issue
call getMessaging asynchronously in your firebase-messaging-sw.js file
The text was updated successfully, but these errors were encountered:
Any news on this? I couldn’t find any official documentation on the usage. Some of the code I found on github uses it the same way OP does, but then it prints the warnings
I ran into this error message too. If I understand correctly, the initialisation of Firebase Push MUST happen in the global scope of the service worker during its initial evaluation – meaning: You cannot call initializeApp/getMessaging asynchronously. They MUST be called immediately when the global scope of the service worker script is first run.
Operating System
macOS Ventura 13.0
Browser Version
Google Chrome Version 120.0.6099.199 (Official Build) (arm64)
Firebase SDK Version
9.22.0
Firebase SDK Product:
Messaging
Describe your project's tooling
React app with Webpack
Describe the problem
I've been seeing these errors in sentry for a while, they come from service worker file even if I register service worker only if
isSupported()
passes.So I decided to do the same check in service worker but I'm getting these warnings if I call
getMessaging
asynchronously afterisSupported()
is resolved (see the screenshot)Can you please confirm my approach with calling
getMessaging
asynchronously only ifisSupported
is correct ? If not what is the correct way usingisSupported
in service worker to prevent getting the error mentioned at the beginning ?Steps and code to reproduce issue
getMessaging
asynchronously in yourfirebase-messaging-sw.js
fileThe text was updated successfully, but these errors were encountered: