Firebase-admin-node: Process not terminated.

Created on 27 Sep 2017  路  3Comments  路  Source: firebase/firebase-admin-node

[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: ubuntu16.04
  • Firebase SDK version: _____
  • Library version: 5.2.1
  • Firebase Product: Firebase Cloud Message

[REQUIRED] Step 3: Describe the problem

I success send push to device using firebase-admin node.js.
I called admin.messageing().sendToDevice(token, payload).then(function(response) {
console.log("Successfully sent message:", response);
});

I didn't using http call to calling admin.messageing().sendToDevice. I just call that function.
Next, I input CLI 'node app.js' for execute that function. Then, I success send message to device. but node process was not terminating.

Why the process not terminate?

kjwook@kjwook-15N540-RFLGL:~/node aa.js
Successfully sent message: { results: [ { messageId: '0:1506502554508960%254b46d6f9fd7ecd' } ],
failureCount: 0,
successCount: 1,
multicastId: 6370642410814556000 }
^[[C^[[A^[[D^[[B

Most helpful comment

Call app.delete() to clean up and ensure graceful termination of all background tasks.

How was the developer supposed to know they had to call app.delete()?

All 3 comments

SDK initialization (admin.initializeApp()) starts some background tasks, which keep the Node process alive. Call app.delete() to clean up and ensure graceful termination of all background tasks.

@hiranya911 what is the appropriate approach to send notifications in service like AWS Lambda or Firebase Functions, where it is imperative to end all activities ASAP? Closing the calling delete on the firebase instance seems way less than ideal. It can easily be forgotten.

Call app.delete() to clean up and ensure graceful termination of all background tasks.

How was the developer supposed to know they had to call app.delete()?

Was this page helpful?
0 / 5 - 0 ratings