Repository navigation
fix(ext/node): throw ERR_INVALID_ARG_VALUE for falsy dns.lookup hostname - #34234
Merged
Merged
Conversation
Match Node 25+ behavior: when `dns.lookup` (or `dnsPromises.lookup`) is called with a falsy hostname, throw/reject `ERR_INVALID_ARG_VALUE` synchronously instead of emitting a DEP0118 DeprecationWarning and resolving with a null address. Node removed the legacy fallback path. Enables the previously commented-out node_compat parallel tests `test-dns-lookup.js` and `test-dns-lookup-promises.js`, which exercise this code path via `assert.throws`/`assert.rejects` on a falsy hostname and would fail loudly when the unexpected DEP0118 fired. Closes denoland/orchid#139 Co-Authored-By: Divy Srivastava <me@littledivy.com>
littledivy
approved these changes
May 19, 2026
littledivy
added a commit
to crowlKats/deno
that referenced
this pull request
Jun 10, 2026
…ame (denoland#34234) ## Summary - `dns.lookup` and `dnsPromises.lookup` now throw/reject `ERR_INVALID_ARG_VALUE` synchronously when called with a falsy hostname, matching Node 25+ (`node/lib/dns.js`, `node/lib/internal/dns/promises.js`). Previously Deno emitted a one-shot DEP0118 `DeprecationWarning` and resolved with a `null` address — Node removed that legacy fallback. - Drops the now-unused `emitInvalidHostnameWarning` helper from `internal/dns/utils.ts`. - Enables the previously skipped node_compat parallel tests `test-dns-lookup.js` and `test-dns-lookup-promises.js`. Those tests stub `cares.getaddrinfo` and assert on `dns.lookup(false, options, cb)` / `dnsPromises.lookup(false, options)`, expecting a sync throw/reject. Before this fix they bailed out with an unexpected `DeprecationWarning` ("DEP0118"), which the issue described as "spurious punycode DEP0040" — the actual emitted code is DEP0118 (invalid hostname), not DEP0040. ## Test plan - [x] `cargo test --test node_compat -- test-dns-lookup` — passes locally (parallel `test-dns-lookup.js`, `test-dns-lookup-promises.js`, `test-dns-lookup-promises-options-deprecated.js`, `test-dns-lookupService.js`, `test-dns-lookupService-promises.js`, internet `test-dns-lookup.js`). - [x] Verified `dnsPromises.lookup('127.0.0.1', { all: true })` still resolves correctly (untouched code path for IP hostnames). Closes denoland/orchid#139 Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dns.lookupanddnsPromises.lookupnow throw/rejectERR_INVALID_ARG_VALUEsynchronously when called with a falsy hostname, matching Node 25+ (node/lib/dns.js,node/lib/internal/dns/promises.js). Previously Deno emitted a one-shot DEP0118DeprecationWarningand resolved with anulladdress — Node removed that legacy fallback.emitInvalidHostnameWarninghelper frominternal/dns/utils.ts.test-dns-lookup.jsandtest-dns-lookup-promises.js. Those tests stubcares.getaddrinfoand assert ondns.lookup(false, options, cb)/dnsPromises.lookup(false, options), expecting a sync throw/reject. Before this fix they bailed out with an unexpectedDeprecationWarning("DEP0118"), which the issue described as "spurious punycode DEP0040" — the actual emitted code is DEP0118 (invalid hostname), not DEP0040.Test plan
cargo test --test node_compat -- test-dns-lookup— passes locally (paralleltest-dns-lookup.js,test-dns-lookup-promises.js,test-dns-lookup-promises-options-deprecated.js,test-dns-lookupService.js,test-dns-lookupService-promises.js, internettest-dns-lookup.js).dnsPromises.lookup('127.0.0.1', { all: true })still resolves correctly (untouched code path for IP hostnames).Closes denoland/orchid#139