Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.delete() not sufficient for node process to disconnect #859

Closed
one19 opened this issue May 23, 2018 · 2 comments
Closed

.delete() not sufficient for node process to disconnect #859

one19 opened this issue May 23, 2018 · 2 comments

Comments

@one19
Copy link

one19 commented May 23, 2018

Environment:

  • Operating System version: MacOS 10.13.4
  • Environment: Node command line interface
  • Firebase SDK version: at least 4.4.0 and beyond
  • Firebase Product: database/auth

Issue:

calling .delete() not sufficient for node process to disconnect.

Steps to reproduce:

What I've thought all along was a pretty standard use for a small cli module:

const ref = await firebase.initializeApp({...});
await ref.auth().signInWithEmailAndPassword(...);

const currentStatusObj = await ref
    .database()
    .ref(...current)
    .once('value');

const newKey = await ref
      .database()
      .ref(...log)
      .child('all')
      .push().key;

await firebase
      .database()
      .ref()
      .update({
        ... multiple paths using path/newKey
      });

return ref.delete()

Except ref.delete() doesn't allow the node process to exit. Ever.

I've had to hack around it with a process.exit() callback for a while now. But now I'm 11 messages into a firebase-functions support issue because using the firebase module in an isomorphic way (functions & cli) causes delays of 20 -> 40 seconds if you return early (even on a hot start). I'd love to narrow down the cause, and to see if this crazy hangup issue that Version 3.4.1 says was fixed is the culprit.

And, just to check, I removed the nice function wrappers and ref passing, and firebase still wouldn't exit on a firebase.app().delete(). nor does .goOffline()

Relevant Code:

https://github.com/one19/im-doin (isomorphic firebase interaction module)
https://github.com/one19/im-doin-slack (function environment where it's not invoked via command line)

firebase web sandbox doesn't provide an adequate location for realizing use case of a node environment.

@a-xin
Copy link

a-xin commented Jun 26, 2018

I had a similar issue where node was not terminating. In my case, I had to also call auth().signOut():

const app = firebase.initializeApp(...);

firebase.database().ref()
  .update(...)
  .then(() => firebase.database().goOffline())
  .then(() => firebase.auth().signOut())
  .then(() => app.delete())

@one19
Copy link
Author

one19 commented Jun 28, 2018

ohmygosh i forgot that I had this as an open ticket! You're absolutely right, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants