You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the validation in dns.resolve has changed (probably due to changes in c-ares, though I can't spot the exact cause) so that IPv6 addresses now return EBADNAME in this case (IPv4 addresses do not, and dns.lookup hasn't change at all).
This happens because cacheable-lookup uses dns.resolve (which rejects this) before using dns.lookup (which would work), and ignoreNoResultErrors does not ignore this error, and so the request fails.
This is a bit weird! It's unusual to do a DNS lookup for an IP obviously, but plenty of code does do this because it's simpler than trying to detect IPs and go down different code paths for that case, and it's clearly supported by the standard dns.lookup API.
To make this library consistent & drop-in compatible with dns.lookup, I think this should return the input address too.
The text was updated successfully, but these errors were encountered:
Repro:
In Node v20.11.1 this returns the input address (this is the same behaviour as dns.lookup).
In Node v20.12.0, this still works fine with
dns.lookup
, but with cacheable-lookup it throws:It seems that the validation in
dns.resolve
has changed (probably due to changes in c-ares, though I can't spot the exact cause) so that IPv6 addresses now return EBADNAME in this case (IPv4 addresses do not, and dns.lookup hasn't change at all).This happens because cacheable-lookup uses dns.resolve (which rejects this) before using dns.lookup (which would work), and
ignoreNoResultErrors
does not ignore this error, and so the request fails.This is a bit weird! It's unusual to do a DNS lookup for an IP obviously, but plenty of code does do this because it's simpler than trying to detect IPs and go down different code paths for that case, and it's clearly supported by the standard dns.lookup API.
To make this library consistent & drop-in compatible with dns.lookup, I think this should return the input address too.
The text was updated successfully, but these errors were encountered: