templates
templates copied to clipboard
fix bug đ push notifications not working for node
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