Closed Snehasis4321 closed 1 month ago
This PR fix the issue where push notification does not work correctly for push-notification-with-fcm template for node.
push-notification-with-fcm
When trying to use push notification fcm cloud function from templates, I found that the function is not working correctly.
Then, I came across this bug đ.
main.js - line : 26 token: req.deviceToken,
token: req.deviceToken,
this will be token: req.body.deviceToken, for that reason the correct device token was not reaching to the sendPushNotification().
token: req.body.deviceToken,
sendPushNotification()
on utils.js everytime we were calling sendPushNotification function we were initializing admin.initializeApp ,
This gives the error firebase-admin already initialized.
firebase-admin already initialized
To fix we need to initialize only once, so initializing outside before calling the sendPushNotification().
after modifying all this it is now working fine.
added a feature to pass additional data payload within the message with the notification.
data
Yes
Done with all the requested changes. Can you please review my code? @loks0n.
moved throwIfMissing to the top of the function.
throwIfMissing
What does this PR do?
This PR fix the issue where push notification does not work correctly for
push-notification-with-fcm
template for node.Test Plan
When trying to use push notification fcm cloud function from templates, I found that the function is not working correctly.
Then, I came across this bug đ.
On previous code:
main.js - line : 26
token: req.deviceToken,
this will be
token: req.body.deviceToken,
for that reason the correct device token was not reaching to thesendPushNotification()
.on utils.js everytime we were calling sendPushNotification function we were initializing admin.initializeApp ,
This gives the error
firebase-admin already initialized
.To fix we need to initialize only once, so initializing outside before calling the sendPushNotification().
after modifying all this it is now working fine.
Feature added :
added a feature to pass additional
data
payload within the message with the notification.Have you read the Contributing Guidelines on issues?
Yes