Connection failed Error: queryTxt ETIMEOUT cluster0.49bhjhk.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:251:17) {
errno: undefined,
code: 'ETIMEOUT',
syscall: 'queryTxt',
hostname: 'cluster0.49bhjhk.mongodb.net'
}
Hey @Kainat_Malik,
Welcome to the MongoDB Community forums
The error message implies a possible SRV lookup failure.
Could you try using the connection string from the connection modal that specifies all 3 hostnames instead of the SRV record?
To get this, please head to the Atlas UI within the Database Deployments section and follow the below steps:
- Click Connect on the cluster you wish to connect to
- Select Connect your application
- Choose Node.JS for the Driver option
- Choose the Version 2.2.12 or later for the version option
- Copy and use the connection string which should begin with the following format:
mongodb://<username>:<password>....
Replace the original connection string you used with the version 2.2.12 or later node.js connection string copied from the above steps and then restart your application.
If it returns a different error, please share that error message here.
In addition to the above, I would recommend also checking out the Atlas Troubleshoot Connection Issues documentation.
Regards,
Kushagra