-
Notifications
You must be signed in to change notification settings - Fork 10k
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
chore: Add a way to remove an invalid token if sendFCM returns 404 #32440
Conversation
Looks like this PR is ready to merge! 🎉 |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #32440 +/- ##
===========================================
- Coverage 56.42% 56.35% -0.07%
===========================================
Files 2447 2450 +3
Lines 53977 54019 +42
Branches 11125 11135 +10
===========================================
- Hits 30457 30444 -13
- Misses 20868 20922 +54
- Partials 2652 2653 +1
Flags with carried forward coverage won't be shown. Click here to find out more. |
Proposed changes (including videos or screenshots)
The old library (
node-gcm
) we used to send messages via the legacy push had some utilities to help us out implementing the specification described here on how to handle error codes, and we used to functions, _removeToken and _replaceToken to minimize the number of unnecessary errors we would propagate over.Now, we had to implement the utility to send messages manually, in #32208 now, we implemented most of the error handling utilities in the function called
fetchWithRetry
, but there was a big one missing, the 404 case.From the spec:
UNREGISTERED (HTTP error code = 404) App instance was unregistered from FCM. This usually means that the token used is no longer valid and a new one must be used.
This error can be caused by missing registration tokens, or unregistered tokens.
Missing Registration: If the message's target is a token value, check that the request contains a registration token.
Not registered: An existing registration token may cease to be valid in a number of scenarios, including:
For all these cases, remove this registration token from the app server and stop using it to send messages.
OBS: not adding
replaceToken
because the new Firebase API does not return the new device token ever, so it is better to just remove it, and let it be recreated when a new push gets sent.Issue(s)
CONN-205
Steps to test or reproduce
You can just follow: #32208
Further comments