Skip to main content

Resolving the Node.js 'QuerySrv ECONNREFUSED' Error Connecting to Atlas From Windows

The information provided in this article is accurate as of February 17, 2026.

E
Written by Emily Tiang

Issue


As described in the troubleshooting querySrv ECONNREFUSED documentation, errors can occur when there are issues resolving DNS records while connecting to clusters using DNS Seedlist Connection Strings.

In certain cases, for applications using Node.js drivers to connect to Atlas, the errors are due to issues with core Node.js libraries on Windows and are not related to Atlas or to resolving the DNS Seedlist records from the application environment.


Symptoms


You will observe the ECONNREFUSED errors when connecting to Atlas from Windows using the Node.js driver:

2026-02-11T11:10:00.123 [Information] Error: querySrv ECONNREFUSED _mongodb._tcp.<CLUSTER_ID>.azure.mongodb.net 
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:292:17) {
errno: undefined,
code: 'ECONNREFUSED',
syscall: 'querySrv',
hostname: '_mongodb._tcp.<CLUSTER_ID>.azure.mongodb.net'
}


Cause


This is a known issue with Node.js v24 on Windows, where DNS SRV lookups fail with ECONNREFUSED. This commonly affects MongoDB connection strings that use SRV records.

You can see more details on this issue for Node.js on Windows in the PR#61453 thread on the official Node.js GitHub repository and the affected version of Node.js v24. You can also see the MongoDB Community Post on querySrv ECONNREFUSED errors to see more versions of Node.js impacted.

Resolution


Before remedying the known Node.js library issues, determine whether the issue is caused by DNS Seedlist records resolving incorrectly in the application environment.

If DNS Seedlist resolution works in your Windows environment but fails exclusively in Node.js, apply one of the solutions below to resolve the Node.js-specific errors:

  • Utilize a Standard Connection String with the mongodb:// prefix (without SRV) to connect to the cluster instead of the seed list string.

  • Consider downgrading to a Node.js version that is not affected by this issue. The MongoDB Community Post on querySrv ECONNREFUSED errors includes a reference list of compatible versions.

Did this answer your question?