firebase.messaging.getToken() edgecase when push notification is set back to default (ask)
Problem
[REQUIRED] Describe your environment Operating System version: macOS Mojave Version 10.14.6 Browser version: Google Chrome Version 78.0.3904.97 Firebase SDK version: 7.0.0 * Firebase Product: Firebase Cloud Messaging [REQUIRED] Describe the problem The issue I have identified was introduced in version 7.0.0 of the firebase-js-sdk. I do not run into this issue in versions previous to 7.0.0. The issue occurs when a use grants notification permissions, gets a FCM token, then updates the notification permissions in the browser back to Ask (default), reloads the page, grants notification permissions again in Chrome, and get an error when trying to getToken at this point. Note: subsequent calls to getToken don't face this issue. Steps to reproduce: The problem occurs after taking the following steps: - Call Notification.requestPermission() and user grants permissions - Call firebase.messaging.getToken() - Set notification permission in browser back to Ask (default) - Call Notification.requestPermission() and user grants permissions - call firebase.messaging.getToken() - get DELETE https://fcmregistrations.googleapis.com/v1/projects/{project_id}/regis.../{FCM_token} 500 error and this specific error from FCM: "FirebaseError: Messaging: A problem occured while unsubscribing the user from FCM: FirebaseError: Messaging: A problem occured while unsubscribing the user from FCM: Internal error encountered. (messaging/token-unsubscribe-failed). (messaging/token-unsubscribe
Error Output
error when trying to getToken at this point. Note: subsequent calls to getToken don't face this issue.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: firebase.messaging.getToken() edgecase when push notification is set back to default (ask)
Thanks for the report. I can consistently reproduce the behavior and I'm investigating the issue. I'd like to ask everyone to please refrain from posting "This is happening to me too" comments and instead use the add reaction feature on the OP to add a thumbs up to issues that you consider important.
Trust Score
8 verifications
- 1
Thanks for the report. I can consistently reproduce the behavior and I'm investi
Thanks for the report. I can consistently reproduce the behavior and I'm investigating the issue.
- 2
I'd like to ask everyone to please refrain from posting "This is happening to me
I'd like to ask everyone to please refrain from posting "This is happening to me too" comments and instead use the add reaction feature on the OP to add a thumbs up to issues that you consider important.
Validation
Resolved in firebase/firebase-js-sdk GitHub issue #2364. Community reactions: 64 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep