Skip to content

dns.resolveSrv() throws ECONNREFUSED on Windows in v24 but works in v22 #63407

@kalebwondimu33

Description

@kalebwondimu33

Version

v24.15.0

Platform

Windows 11 x64

Subsystem

dns

What steps will reproduce the bug?

Run the following code on Windows with Node.js v24:

const dns = require('dns');
dns.resolveSrv('_mongodb._tcp.cluster0.rlz7nlb.mongodb.net', (err, addresses) => {
console.log(err, addresses);
});

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

Reproduces every time on Windows with Node.js v24.
Does not reproduce on Node.js v22 or v20 on the same machine with the same network.
The SRV record exists and resolves correctly via nslookup:

nslookup -type=SRV _mongodb._tcp.cluster0.rlz7nlb.mongodb.net 8.8.8.8

Returns valid SRV records with 3 hostnames on port 27017.

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

dns.resolveSrv() should successfully resolve the SRV record and return
the list of hostnames, the same way nslookup does and the same way
Node.js v22 does.

What do you see instead?

Error: querySrv ECONNREFUSED _mongodb._tcp.cluster0.rlz7nlb.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/callback_resolver:45:19) {
errno: undefined,
code: 'ECONNREFUSED',
syscall: 'querySrv',
hostname: '_mongodb._tcp.cluster0.rlz7nlb.mongodb.net'
}

Additional information

  • Downgrading to Node.js v22 on the same machine fixes the issue immediately
  • DNS is set to Google DNS (8.8.8.8)
  • nslookup confirms the SRV record resolves correctly at the OS level
  • The issue was discovered while trying to connect to MongoDB Atlas using
    Mongoose, which uses mongodb+srv:// connection strings that rely on SRV
    DNS resolution
  • No antivirus or firewall interference (McAfee was uninstalled and tested)
  • VPN was also tested — did not affect the outcome
  • Other PCs on the same network running Node.js v22 connect successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions