Skip to content

Node script using firebase js sdk (v9) doesn't terminate #4987

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

Closed
mgreenbe opened this issue Jun 6, 2021 · 4 comments
Closed

Node script using firebase js sdk (v9) doesn't terminate #4987

mgreenbe opened this issue Jun 6, 2021 · 4 comments

Comments

@mgreenbe
Copy link

mgreenbe commented Jun 6, 2021

[REQUIRED] Describe your environment

  • Operating System version: MACOS 11.5
  • Browser version: N/A
  • Firebase SDK version: 9.0.0-beta.2
  • Firebase Product: functions

[REQUIRED] Describe the problem

A simple node script calling a cloud function (handled by the functions emulator) doesn't terminate, even though I deleted the relevant app. If I remove the function call (line labelled (*)) and the call to deleteApp (line labelled (**)), then the script terminates normally.

Steps to reproduce:

Run the script below. "Done!" is logged too the console, but the process doesn't terminate.

Relevant Code:

let { initializeApp, deleteApp } = require("firebase/app")
let { getFunctions, useFunctionsEmulator, httpsCallable } = require("firebase/functions");

let config = {
// redacted!
};


async function f() {
    let app = initializeApp(config)
    let fns = getFunctions(app)
    useFunctionsEmulator(fns, "localhost", 5001)
    let helloWorld = httpsCallable(fns, "helloWorld")
    console.log(await helloWorld()) // (*)
    await deleteApp(app) // (**)
}

f().then(() => { console.log("Done!") })
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@mgreenbe mgreenbe changed the title Node script using firebase js sdk doesn't terminate Node script using firebase js sdk (v9) doesn't terminate Jun 6, 2021
@looptheloop88
Copy link

Hi @mgreenbe, I wasn't able to replicate the issue. The function execution was finished successfully. If you're trying to create a function that will return a promise or return the helloWorld value as a promise, then try to use the code snippets below:

 function f() {
    return new Promise(async resolve => {
      const helloWorld = await httpsCallable(fns, 'helloWorld');
      resolve(helloWorld);
    });
 }

f().then((res) => { console.log(res) })

Also, it would help a lot if you could share a minimal, but complete sample of a project that I can run locally to replicate the issue.

@google-oss-bot
Copy link
Contributor

Hey @mgreenbe. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@mgreenbe if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Jul 23, 2021
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