9

Below is a simple example how I am using firebase:

let firebase = require('firebase');
firebase.initializeApp({
  serviceAccount: './config/firebase.json',
  databaseURL: 'https://thenameofhedatabase.firebaseio.com'
});

let db = firebase.database();
...
...

The point is that after all code execution the db object holds the node.js session. I do not want to call process.exit(0). So, what is the right way to close or dispose the db object of the firebase?

Andrei Tarutin
  • 684
  • 1
  • 10
  • 25

1 Answers1

11

This is something that has been fixed in the version 3.4.1 of the JavaScript SDK.

firebase.database().goOffline() now properly releases the database so the Node.js process can exit.

agregoire
  • 2,022
  • 1
  • 16
  • 15