Description
Operating System
Windows
Browser Version
Firefox
Firebase SDK Version
9.23
Firebase SDK Product:
Messaging
Describe your project's tooling
Angular. Spring Boot
Describe the problem
When calling deleteToken()
I receive this error:
ERROR Error: Uncaught (in promise): 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).
This Error is caused by a 404 HTTP DELETE Request.
While this is no Problem in of itself, the Token in the Indexed Database is not removed or invalidated in the process.
The token stored in the Indexed Database appears to remain valid. This is evident when we retrieve the token using the getToken
function, as it returns the locally stored token which Firebase is unaware of. Consequently, we provide our backend with a token that Firebase does not recognize.
Now when the Backend sends a Notification to this Token we, obviously, get a Token not found Error
from the Firebase Admin SDK, so we remove the Token from our Database.
The next time the user logs on, our Code checks and sees that his Browsertoken is not part of the active Tokens and trys to refresh his token, which just returns the same as before, his wrong, inactive but valid token.
Steps and code to reproduce issue
This issue is quite difficult to reproduce, since it only occurs when the Token in the IndexedDB is not recognized by Firebase.
But what I can say for certain is that I encountered it multiple times, on multiple different PCs with different Users on different Firebase Applications (QA & Prod)