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

Enhancement: Improved Handling FCM tokens #39

Open
gkatrakazas opened this issue Dec 12, 2023 · 0 comments
Open

Enhancement: Improved Handling FCM tokens #39

gkatrakazas opened this issue Dec 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@gkatrakazas
Copy link
Member

FCM Token Handling During Signup:
We should enhance our signup process to remove the storing FCM token because the store now being after signup/login.

Delete invalid FCM token when try to send notification.

In the following code, we should handle the FirebaseMessagingError with the message 'Requested entity was not found.' This error may indicate that the FCM token has expired or been deleted, so it's advisable to handle this situation by deleting the invalid token.

https://github.com/wwWallet/wallet-backend-server/blob/9d9597632085301528f0d4c6b0aa6a2a560ec170/src/lib/firebase.ts#L42C1-L48C7

admin.messaging().send(message)
        .then((response) => {
        console.log(response + ' messages were sent successfully');
        })
        .catch(err => {
                console.log("failed to send firebase message")
        });
@gkatrakazas gkatrakazas added the enhancement New feature or request label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant