-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase Cloud Messaging getToken hangs forever on web #8754
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hi @liezl200, I am unable to reproduce this. To help us identify the source of this issue, could you please
I also recommend upgrading to the latest version of the Firebase JS SDK (11.2.0) to confirm that this issue has not already been fixed. |
I've updated to 11.2.0 but it's still hanging package.json:
I used
** How can I figure out which line in the Firebase SDK it's actually getting stuck in during the call to getToken? Any recommendations for where to set some breakpoints? ** I did see one (seemingly flaky error) but can't reliably reproduce this
Additional contextI've removed the extra code that registers service workers. I can tell that getToken does successfully register the sw because I tried on a brand new Chrome profile while using Chrome debugger and could see the sw register. For the below, I have tried my actual VAPID KEY and also intentionally fudged it to see if it would non-silently fail, and getToken actually did fail / didn't hang when I intentionally used the wrong one
firebase-messaging-sw.js
Note I had to use -compat because I was getting Network error trying to directly importScripts 'https://www.gstatic.com/firebasejs/11.2.0/firebase-app.js' I see everything printed out, including the "got msg" console.log line that I put right after |
@liezl200 Thanks for sharing more information. It's interesting that the service worker is registered, but I believe the Firestore error you shared is unrelated. |
Operating System
MacOS Sonoma 14.4.1
Environment (if applicable)
Chrome 132.0.6834.160 (Official Build) (arm64)
Firebase SDK Version
8.10.1
Firebase SDK Product(s)
Messaging
Project Tooling
React app (nextjs)
I also tried 9.0.0 on my local dev machine with localhost
Detailed Problem Description
The last known time this getToken code path worked correctly in my production environment was 1pm EST today. Around 4pm EST I noticed FCM was throwing "Unknown token" errors when trying to push notifications to my test accounts. Thinking I could reset the permission, I started trying to Reset permission then Allow permission, but now getToken is hanging forever and I can't register any more FCM tokens
Steps and code to reproduce issue
try {
const msg = await messaging()
if (!msg) {
console.error('Firebase messaging is not supported or failed to initialize')
return
}
console.log('Firebase messaging initialized successfully')
The text was updated successfully, but these errors were encountered: