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
{{ message }}
Repository navigation
dns.resolveSrv returns ECONNREFUSED on Windows since v24.13.0 (still broken in v25.x and v26.x) #62326
changed the title [-]dns.resolveSrv returns ECONNREFUSED on Windows since v24.13.0 (still broken in v25.x)[/-][+]dns.resolveSrv returns ECONNREFUSED on Windows since v24.13.0 (still broken in v25.x and v26.x)[/+]on May 11, 2026
But it needed to be fixed upstream, which c-ares team already did, but they still haven't released the latest changes, I created the issue to follow up when it will be released:
I was using 26.3.0 version and the following command node -e "require('dns'); console.log(require('dns').getServers())" would result in [ '127.0.0.1' ].
I switched to the previously installed version 24.12.0 for a correct DNS query, i.e., [ '192.168.1.1' ].
Ran into this exact issue on Windows while connecting to MongoDB Atlas over a mobile data hotspot connection. Node's resolver completely fails on the SRV lookup, throwing ECONNREFUSED.
For anyone looking for an immediate programmatic workaround in their code without changing their OS environment, you can force Node's engine to use public Google/Cloudflare servers at the application entry point.
Placing this snippet at the absolute top of the entry file (before any database initialization) completely resolves the ECONNREFUSED failure:
✅ Node.js v22.23.3 now includes c-ares v1.34.8, which contains the upstream fix.
I wasn't able to reproduce the issue on my new PC to independently confirm the fix on v22.23.3, but since the c-ares version containing the fix is now included, there shouldn't be any reason for the issue to persist.
Activity
mathsoft-dev commentedon Mar 19, 2026
Yes, I'm having the same issue as before with the latest versions of 24 and 25 on Windows.
sunjay-dev commentedon Mar 21, 2026
I’m seeing the exact same problem on Windows. When I use Node v24.11.0, my MongoDB connection works fine:
But after upgrading to Node v24.14.0, the same code throws:
fix(dns): fall back to public resolver on system DNS failure
fix(dns): fall back to public resolver on system DNS failure
fix(dns): fall back to public resolver on system DNS failure
dantongarrido commentedon Apr 18, 2026
I have the same problem, can confirm the last working version on Node.js 24 is v24.12.0
[-]dns.resolveSrv returns ECONNREFUSED on Windows since v24.13.0 (still broken in v25.x)[/-][+]dns.resolveSrv returns ECONNREFUSED on Windows since v24.13.0 (still broken in v25.x and v26.x)[/+]niridya commentedon May 11, 2026
I tested this again on the latest Node.js 26 release, and the issue is still present.
Environment:
dns.resolveSrv()still returnsECONNREFUSEDexactly like in previous reports.Cherry commentedon May 21, 2026
This also seems to impact other
resolvefunctions too, likeresolveMx:Error: queryMx ECONNREFUSED example.comnull [ { exchange: '', priority: 0, type: 'MX' } ]And even just:
Error: queryA ECONNREFUSED example.comnull [ '172.66.147.243', '104.20.23.154' ]greguintow commentedon Jun 1, 2026
@niridya I created the fix here:
But it needed to be fixed upstream, which c-ares team already did, but they still haven't released the latest changes, I created the issue to follow up when it will be released:
This is what I've been doing for now:
niridya commentedon Jun 2, 2026
Thanks for the update and for tracking this upstream.
That explains why I'm still seeing the issue on the current public Node.js v26.x release. I'll keep an eye on the c-ares release and the related PRs.
yasharya2901 commentedon Jun 13, 2026
I was using 26.3.0 version and the following command
node -e "require('dns'); console.log(require('dns').getServers())"would result in[ '127.0.0.1' ].I switched to the previously installed version
24.12.0for a correct DNS query, i.e.,[ '192.168.1.1' ].Switch to standard MongoDB connection string.
Switch to standard MongoDB connection string.
divyam-1604 commentedon Jun 29, 2026
Ran into this exact issue on Windows while connecting to MongoDB Atlas over a mobile data hotspot connection. Node's resolver completely fails on the SRV lookup, throwing
ECONNREFUSED.For anyone looking for an immediate programmatic workaround in their code without changing their OS environment, you can force Node's engine to use public Google/Cloudflare servers at the application entry point.
Placing this snippet at the absolute top of the entry file (before any database initialization) completely resolves the
ECONNREFUSEDfailure:niridya commentedon Jul 6, 2026
Just a quick follow-up: according to the upstream c-ares issue, the fix has now been released in c-ares 1.34.7.
Hopefully this unblocks the Node.js side of the fix. Thanks again for tracking this upstream.
niridya commentedon Jul 8, 2026
I can confirm that this issue is no longer reproducible on the public Node.js v26.5.0 release on Windows. 🎉
I also tested the latest active LTS releases:
So at the moment, this appears to be fixed in the v26.x release line, while the current LTS release lines are still affected.
niridya commentedon Aug 3, 2026
Quick update after testing the latest releases:
niridya commentedon Sep 24, 2026
Quick update:
I wasn't able to reproduce the issue on my new PC to independently confirm the fix on v22.23.3, but since the c-ares version containing the fix is now included, there shouldn't be any reason for the issue to persist.