-
Notifications
You must be signed in to change notification settings - Fork 893
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.messaging.getToken() edgecase when push notification is set back to default (ask) #2364
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
I also ran into this error just as the OP described. |
I am also getting this issue. |
Thank for the report. I was able to reproduce this using the quick start guide and filed an internal report (b/144697421). I'm just wondering if you y'all happen to consistently facing this issue. There are times that I can only reproduce it on the initial load or upon requesting permission several times. Are there any particular patterns you notice that significantly contributes to the issue (aside from what mentioned)? |
Hi rommelpe, This issue only arises after the a reset of notifications permissions and reload of page and then works properly with an additional reloaded pages. Aside from what I mentioned there are no other patterns that contribute to the issue identified. Thanks, and let me know if there are any other questions. |
I'm getting the same issue when I remove the push notifications permission and reload. |
I am also getting this issue. |
I'm getting the same error :( |
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. |
Any update on this issue? |
Hello, sorry for the lack of updates. Looks like the problem is in our backend, but there wasn't much progress as we've had a code freeze last week (because of black friday). I should be able to give you a better update or even a fix later this week. |
Can we have the latest updates regarding this issue? |
Hey everyone, our backend team is still investigating this. Since it's taking longer than my initial estimate, I just submitted a PR to temporarily suppress this error. |
Also reproduced this issue and need a fix |
This is happening to me too |
The temporary change to suppress the error, mentioned by @mmermerkaya above, is in 7.6.0 which has just been released. |
Using 7.6.0 and am still having the same issue! |
If you're only seeing the error in the console, that's normal. My PR is still logging the error in the console, but it should not stop the |
I am receiving a token value when https://firebaseinstallations.googleapis.com/v1/projects/.../authTokens:generate is called, but get a "500" error when calling getToken() |
I get this error when using "127.0.0.1" instead of localhost.
|
The CORS error looks like an unrelated issue. Can you create a new bug report for that? |
@mmermerkaya did you created new issue for CORS problem? |
@Ridermansb @mmermerkaya @GoktuqCan @CodeByBryan could you check if #2467 matches the issue that you are observing? |
I am having the issue in a Chrome Extension. when getToken() is called I recieve:
I am not getting any CORS errors |
I tried this solution. It is fixed, but when you disable and enable the status for browser notification, it happens again. |
Hi y'all, We've had this problem (or related ones) for a long time. I think I finally got it all working today. This is how. I believe Firebase messaging is just buggy when you try to register your own service worker instead of providing the firebase-messaging-sw.js file. So the fix was to create that file and then reference at the end of my own
Then you no longer need to pass serviceWorkerRegistration into getToken, simply call:
And it just works! |
I'm having exactly the same issue
Using It seems like this issue takes place due to cache errors. So to fix it I am always clearing cache, that's pity :( Unfortunately I don't have an ability to use firebase-messaging-sw.js, that's why @jahooma method wont work for me |
I'm getting this error on Chrome and not in Firefox. if that helps |
I'm using My firebase SDK is 9.6.1 |
This issue still persists and only way to "temporarily" solve it is to |
I get this error also with firebase v9.6.10 in Chrome but not in Firefox! _FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: Requested entity was not found. (messaging/token-unsubscribe-failed). (messaging/token-unsubscribe-failed). I can confirm the clearing the application storage on the developer console solves the problem temporarily, but it is not the best solution. |
This is happening to me aswell with version Firebase JS SDK 9.9.0 wrapped within Flutter Firebase SDK. It happens really often while testing PWA and browser navigation. It seems like the Firebase SDK is returning an already deleted token no matter what. Even if in the code there is a call to get a new token, it's returning the same invalid token. |
Same issue |
@jaysonmulwa the comment you posted link to seems not be there anymore. Can you tell what was the solution mentioned in it? |
Hi @srihari9n , It's been quite a while, will try to recall what the solution was. |
I'm seeing this randomly as well. When this happened back in 2021 it ended up being a backend issue on Google's side that they fixed. See: #5081 I'm wondering if there was a regression and it's happening again? @jaysonmulwa if you can remember the work around we'd be able to use it as well. |
It still work for me in 2023 ✌️ Thanks Mwamiq381 |
Seeing the same issues on |
I'm having the same issue. Version |
this error is still producing in the firebase version |
Have it |
Not actual problem. Just save and check token in database. |
this is an annoying bug. |
the issue is produced in the Firebase version ^10.1.0 |
Still able to reproduce. Why is it taking so long to fix this? |
Any news? 🥲 |
I encountered this error about a month ago, and it was really frustrating. After multiple debugging attempts, I was able to fix it, and I haven't encountered it since. Although I'm not certain about the root cause of this error, I suspect it was triggered by changes in the idToken. Changing the idToken seemed to lead to the issue of unregistering the FCM token. After reviewing the places where getIdTokenResult and getIdToken were used, especially when setting forceRefresh to true, which caused a change in the idToken, the error no longer occurred. I don't recall the details, but the problem seemed to be related to modifying the idToken. I hope this information can help someone else eliminate a similar issue. |
When we update the site permissions from browser settings (while our website is not active), for example, I changed the notification permission to Blocked from Allow, and then back to Allow, now I'd expect to start receiving push notifications (right?). But the fcm v1 api returns 'Requested entity not found'. I believe it's a similar case as resetting the permissions as @thomasmburke has mentioned. In any case in the source code, the error has been quietly handled. Is there any update here, team firebase? |
Any news? |
[REQUIRED] Describe your environment
[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-failed)."
call messaging.getToken() again
get new token, no error this time.
Others have encountered this issue as well on Google Groups:
https://groups.google.com/a/google.com/forum/#!msg/firebase-developer-cuf/dGU1SnJ1cz0/GMa_WvWGBwAJ
Relevant Code:
The firebase javascript messaging quickstart encounters this issue:
https://github.com/firebase/quickstart-js/tree/master/messaging
Specifically, I think the update needs to be made here:
firebase-js-sdk/packages/messaging/src/controllers/base-controller.ts
Lines: 136-137
The text was updated successfully, but these errors were encountered: