Skip to content

Commit a94c744

Browse files
committed
Merge remote-tracking branch 'upstream/alpha' into alpha
2 parents d07892c + 6bdd87c commit a94c744

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [7.1.0-alpha.13](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.12...7.1.0-alpha.13) (2024-07-01)
2+
3+
4+
### Bug Fixes
5+
6+
* Invalid push notification tokens are not cleaned up from database for FCM API v2 ([#9173](https://github.com/parse-community/parse-server/issues/9173)) ([284da09](https://github.com/parse-community/parse-server/commit/284da09f4546356b37511a589fb5f64a3efffe79))
7+
18
# [7.1.0-alpha.12](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.11...7.1.0-alpha.12) (2024-06-30)
29

310

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "7.1.0-beta.1",
3+
"version": "7.1.0-alpha.13",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

src/StatusHandler.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,23 @@ export function pushStatusHandler(config, existingObjectId) {
237237
) {
238238
const token = result.device.deviceToken;
239239
const error = result.response.error;
240-
// GCM errors
240+
// GCM / FCM HTTP v1 API errors; see:
241+
// https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
241242
if (error === 'NotRegistered' || error === 'InvalidRegistration') {
242243
devicesToRemove.push(token);
243244
}
244-
// APNS errors
245+
// FCM API v2 errors; see:
246+
// https://firebase.google.com/docs/cloud-messaging/manage-tokens
247+
// https://github.com/firebase/functions-samples/blob/703c0359eacf07a551751d1319d34f912a2cd828/Node/fcm-notifications/functions/index.js#L89-L93C16
248+
if (
249+
error?.code === 'messaging/registration-token-not-registered' ||
250+
error?.code === 'messaging/invalid-registration-token' ||
251+
(error?.code === 'messaging/invalid-argument' && error?.message === 'The registration token is not a valid FCM registration token')
252+
) {
253+
devicesToRemove.push(token);
254+
}
255+
// APNS errors; see:
256+
// https://developer.apple.com/documentation/usernotifications/handling-notification-responses-from-apns
245257
if (error === 'Unregistered' || error === 'BadDeviceToken') {
246258
devicesToRemove.push(token);
247259
}

0 commit comments

Comments
 (0)