Skip to content
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

Remove unregistered FCM tokens #9085

Open
mtrezza opened this issue Apr 15, 2024 · 3 comments
Open

Remove unregistered FCM tokens #9085

mtrezza opened this issue Apr 15, 2024 · 3 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@mtrezza
Copy link
Member

mtrezza commented Apr 15, 2024

New Feature / Enhancement Checklist

Current Limitation

Google notified in April 2024 that:

Starting May 15, 2024, the stale tokens and topic subscriptions for devices, which have not been connected to FCM in over 270 days, will be considered as expired and invalid. If a request is sent to an invalid token, it will be rejected with a 404 (UNREGISTERED) error.

We recommend you to confirm that your service handles 404 error codes from FCM correctly. Please delete your record of any tokens with a 404 response code because they will not be valid again.

It doesn't seem that Parse Server would be properly handling this UNREGISTERED error, but it's hard to tell how these errors provided by the push adapter translate to the existing error strings:

// GCM errors
if (error === 'NotRegistered' || error === 'InvalidRegistration') {
devicesToRemove.push(token);
}

Feature / Enhancement Description

Ensure that Parse Server deletes "unregistered" tokens.

3rd Party References

Copy link

parse-github-assistant bot commented Apr 15, 2024

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Apr 15, 2024
@mtrezza mtrezza pinned this issue Apr 19, 2024
@jimnor0xF
Copy link

jimnor0xF commented May 8, 2024

Would very much like this feature merged in, so I think I'll look into this soon.

FCM returns the following error object when not registered:
{"code":"messaging/registration-token-not-registered","message":"Requested entity was not found."}

So could perhaps simply add an additional check on the code key there.

@mtrezza
Copy link
Member Author

mtrezza commented May 9, 2024

Yes, the errors are passed in an array from the push adapter to Parse Server, which then removes the tokens based on the error message. You could just add the error text to that logic I've mentioned above.

Side note: the current solution is not elegant, because the logic in which the errors are parsed is in Parse Server, but it seems that it should be in the push adapter, since these errors are push API specific. Opened parse-community/parse-server-push-adapter#244.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants