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

2.1.5 regression: getaddrinfo ENOTFOUND metadata.google.internal #27642

Open
dandv opened this issue Jan 12, 2025 · 5 comments
Open

2.1.5 regression: getaddrinfo ENOTFOUND metadata.google.internal #27642

dandv opened this issue Jan 12, 2025 · 5 comments
Assignees

Comments

@dandv
Copy link

dandv commented Jan 12, 2025

I'm getting this error on Linux with 2.1.5 but not with 2.1.4 in a script that connects to the Firestore emulator running locally.

https://en.wikipedia.org/wiki/.internal

Let me know if I should take the time to put together a minimal repro, or if this report is enough.

@kt3k
Copy link
Member

kt3k commented Jan 15, 2025

Can you run the below script with both Node and Deno? Is there any difference?

import dns from "node:dns"
dns.lookup("metadata.google.internal", console.log)

connects to the Firestore emulator running locally.

Where do you set up domain mapping for metadata.google.internal?

@kt3k kt3k self-assigned this Jan 15, 2025
@dandv
Copy link
Author

dandv commented Jan 15, 2025

Different errno with Node v22.12.0:

$ deno dns.ts
✅ Granted net access to "1.1.1.1:53".
✅ Granted net access to "8.8.8.8:53".
Error: getaddrinfo ENOTFOUND metadata.google.internal
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_ (ext:deno_node/internal/errors.ts:246:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:37:26)
    at ext:deno_node/internal_binding/cares_wrap.ts:78:9
    at eventLoopTick (ext:core/01_core.js:175:7) {
  errno: -3007,
  code: "ENOTFOUND",
  syscall: "getaddrinfo",
  hostname: "metadata.google.internal"
}
$ node dns.mjs
Error: getaddrinfo ENOTFOUND metadata.google.internal
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'metadata.google.internal'
}

Where do you set up domain mapping for metadata.google.internal?

Nowhere. I've never seen this TLD until I ran into this bug. The error comes from attempting to connect to the Firestore emulator running locally via firebase emulators:start --only firestore.

Here's a minimal repro:

import { initializeApp } from 'firebase-admin/app';
import { getFirestore } from 'firebase-admin/firestore';

// Per https://firebase.google.com/docs/emulator-suite/connect_firestore#admin_sdks
Deno.env.set('FIRESTORE_EMULATOR_HOST', '127.0.0.1:8080');
initializeApp();
const db = getFirestore();
await db.collection('deno-bug').get();
$ deno run --allow-all deno-firestore-local.ts
error: Uncaught Error: getaddrinfo ENOTFOUND metadata.google.internal.
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_ (ext:deno_node/internal/errors.ts:246:10)
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:43:26)
    at ext:deno_node/internal_binding/cares_wrap.ts:71:9
    at eventLoopTick (ext:core/01_core.js:175:7)

2.1.4 correctly outputs nothing:

$ deno run --allow-all deno-firestore-local.ts
A new release of Deno is available: 2.1.4 → 2.1.5 Run `deno upgrade` to install it.

@EdJoPaTo
Copy link

I had something similar and the annoying part about it: It ran in a container without interactive prompts so it didn't display any permissions that weren't granted. The only error message is the ENOTFOUND with the domain I configured as --allow-net=…. Figuring out Deno failed DNS requests was annoying as I checked all kinds of possible network issues with the container environment first before realizing deno had failing permissions.

It's also not possible to add --allow-net=:53,… to just allow all DNS requests so it's not even possible to work around currently. (Other than --allow-net without arguments but why use permissions in the first place then?)

@kt3k
Copy link
Member

kt3k commented Jan 28, 2025

@dandv What happens if you set the nameservers in /etc/resolv.conf like this comment

@dandv
Copy link
Author

dandv commented Jan 29, 2025

@kt3k first off, with nothing in /etc/resolv.conf,

  • With Deno 2.1.7 I see different behavior: after a long wait (about 1m 45s), the script outputs nothing, which would be correct (unless it exits silently for another reason).
  • 2.1.4 outputs nothing after ~5 seconds.
  • 2.1.5 still outputs getaddrinfo ENOTFOUND metadata.google.internal as above immediately, confirming my environment hasn't changed in that regard.
  • 2.1.6 - same as 2.1.5

If I set nameserver 8.8.8.8 in /etc/resolv.conf,

  • 2.1.7 outputs nothing, but in about 3m 30s.
  • 2.1.6 and 2.1.5 output getaddrinfo ENOTFOUND metadata.google.internal as above after 1-2 seconds
  • 2.1.4 outputs nothing after ~5 seconds. Best behavior.

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

No branches or pull requests

3 participants