Skip to content

dns.lookup options..family throw errors when using 'IPv4' #54961

Closed as not planned
@tomek3e

Description

@tomek3e

Version

v22.4.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

dns

What steps will reproduce the bug?

import dns from 'node:dns/promises';

async function dnsLookup(){
await dns.lookup("localhost", {family: 'IPv4' })
}

dnsLookup()

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Function not to throw.

What do you see instead?

Throws
TypeError: The property 'options.family' must be one of: 0, 4, 6. Received 'IPv4'

Additional information

Same happens on v20.14.0, v18.18.0.
According to the documentation IPv4 and IPv6 should be accepted https://nodejs.org/docs/latest-v22.x/api/dns.html#dnslookuphostname-options-callback

family | The record family. Must be 4, 6, or 0. For backward compatibility reasons,'IPv4' and 'IPv6' are interpreted as 4 and 6 respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value 0 is used with { all: true } (see below), either one of or both IPv4 and IPv6 addresses are returned, depending on the system's DNS resolver. Default: 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions