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

node:dns resolver ignores TTL option #27669

Open
slagiewka opened this issue Jan 14, 2025 · 1 comment
Open

node:dns resolver ignores TTL option #27669

slagiewka opened this issue Jan 14, 2025 · 1 comment
Labels

Comments

@slagiewka
Copy link

Version: Deno 2.1.5

import {resolve4} from "node:dns/promises";

resolve4("deno.com", {ttl: true}).then(console.log);

Expected result:

[{ address: '34.120.54.55', ttl: 12345 }]

Actual result:

[ "34.120.54.55" ]

Deno docs are aware of possible object being returned: https://docs.deno.com/api/node/dns/promises/~/resolve4

Node docs specify the behaviour for ttl: true: https://nodejs.org/api/dns.html#dnspromisesresolve4hostname-options

It makes cacheable-lookup fail because the library sets the option and expects the object to be returned:

error: Uncaught TypeError: Cannot create property 'family' on string '34.120.54.55'
    at CacheableLookup._resolve (file:///my_home/node_modules/cacheable-lookup/source/index.js:264:20)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async CacheableLookup.queryAndCache (file:///my_home/node_modules/cacheable-lookup/source/index.js:347:17)
    at async CacheableLookup.query (file:///my_home/node_modules/cacheable-lookup/source/index.js:235:20)
    at async CacheableLookup.lookupAsync (file:///my_home/node_modules/cacheable-lookup/source/index.js:178:18)
@siaeyy
Copy link
Contributor

siaeyy commented Jan 14, 2025

In op_dns_resolve, we only deal with record data (Format). So we can not deal with ttl values, in both node:dns and Deno.resolveDns. I think some basis things in operations module should be changed.

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

No branches or pull requests

3 participants