Skip to content

Enhancement: Improved Handling FCM tokens #39

@gkatrakazas

Description

@gkatrakazas

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")
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions