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

firestore does not work properly in from node 18 #5755

Open
daenamkim opened this issue Apr 28, 2023 · 4 comments
Open

firestore does not work properly in from node 18 #5755

daenamkim opened this issue Apr 28, 2023 · 4 comments

Comments

@daenamkim
Copy link

[REQUIRED] Environment info

firebase-tools:

  • 11.29.1

Platform:

  • macOS 13.3.1
  • linux (ubuntu-latest of GitHub CI)

[REQUIRED] Test case

See an attached file: firebase-tools-report.zip

[REQUIRED] Steps to reproduce

See an attached file: firebase-tools-report.zip

[REQUIRED] Expected behavior

Should be success (since it has been passed until node 16)

Out of curiosity, I see this when I did not put runtime in firebase.json, does this mean higher than 16 is not supported? Since I have tested node 17 and 18, both did not work.

⬢  functions: Failed to load function definition from source: FirebaseError: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": 10|12|14|16}

[REQUIRED] Actual behavior

    1) "after each" hook: afterEach for "should set the admin claim when user claim is created 1"


  1 passing (38ms)
  1 failing

  1) "after each" hook: afterEach for "should set the admin claim when user claim is created 1":
     Error: connect ECONNREFUSED ::1:8580
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
@daenamkim
Copy link
Author

Interesting thing I found is that it has been passed in node 20! But I don't want to use node 20 at the moment so it would be happy to use node 18.

@daenamkim
Copy link
Author

Any update for this? 🙇

@aalej
Copy link
Contributor

aalej commented May 2, 2023

Hi @daenamkim, apologies for the delay and thanks for the MCVE and the detailed description of the issue you're encountering. I was able to replicate the issue you mentioned, when I tried running yarn test it fails when using Node v18, but not when using Node v16 or v20. Also, when I tried not setting a specific value for the runtime, I also encountered the same error message.

I’ll notify our team about these issues so that they can provide more context and investigate what might be causing this.

@christhompsongoogle
Copy link
Contributor

Hi daenamkim,

After investigating with aalej and lahirumaramba this is a known issue where Node's 18 defaults to ipv6 address resolution:
node-fetch/node-fetch#1624

One solution proposed in that bug is setting the following in your App:
dns.setDefaultResultOrder('ipv4first')

That will work around the issue in the short term.

The solution we've taken in the emulator suite is to use an explicit IP address like 127.0.0.1 instead of localhost. In this case I need to investigate the hostname resolution since it's not obvious at first glance where it's deriving "locahost" from.

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

No branches or pull requests

5 participants