-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
[READ] Step 1: Are you in the right place?
- For issues or feature requests related to the code in this repository
file a Github issue.- If this is a feature request make sure the issue title starts with "FR:".
- For general technical questions, post a question on StackOverflow
with the firebase tag. - For general Firebase discussion, use the firebase-talk
google group. - For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: Mac OS High Sierra (10.13.1)
- Firebase SDK version: firebase: (^4.5.1)
- Library version: firebase-admin (^5.4.2)
- Firebase Product: FCM / admin.messaging()
[REQUIRED] Step 3: Describe the problem
NodeJS program doesn't terminate after running FCM command.
Steps to reproduce:
- save the following code as: fcm-test.js
- run the code with
node fcm-test.js
- In my enviroment, it'll not stop untill you forcefully stop it by pressing CTRL+C.
Relevant Code:
const admin = require('firebase-admin');
const serviceAccount = require("../../../service-accounts/production.json");
const registrationTokens = require('./tokens');
// ["someShortString1:someLongString1", "someShortString2:someLongString2", ...];
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
})
const body = 'body';
const title = 'title';
const payload = {
data: {
body,
title
},
notification: {
body,
title
}
}
const fcm = admin.messaging();
const printJSON = (thing) => { console.log(JSON.stringify(thing, null, 2))};
fcm.sendToDevice(registrationTokens, payload).then(printJSON).catch(printJSON);
Metadata
Metadata
Assignees
Labels
No labels