NodeJS program doesn't terminate after running FCM command.
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);
[READ] Step 1: Are you in the right place?
file a Github issue.
with the firebase tag.
google group.
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
NodeJS program doesn't terminate after running FCM command.
Steps to reproduce:
node fcm-test.jsRelevant Code: