Title: Troubleshooting MongoDB Atlas Connection Failure with DNS Resolution Error

Hi there,
I’m encountering an issue when trying to connect my application to my MongoDB Atlas cluster, and I’m hoping the community can help me troubleshoot this problem.
The details are as follows:

Atlas Tier: I’m on the M2 Standard cluster tier in MongoDB Atlas.
Steps Followed: I’ve followed the steps to set up a new MongoDB Atlas cluster and attempted to connect my Node.js application using the provided connection string. However, I’m seeing a “MongoNetworkError: Socket connection establishment was cancelled after 20” error, which seems to be related to a DNS resolution problem.
VPN Usage: I’m not using a VPN server when attempting to connect to the MongoDB Atlas cluster.
Client Environment Details:

Driver: MongoDB Node.js driver, version 6.8.2
MongoDB Compass: Version 1.33.1
Operating System: Windows 11

Network Tests:
I’ve performed the network tests as suggested in this post, and here are the results:

nslookup parkshare-db-shard-00-01.wzbiv.mongodb.net:27017: The DNS server is unable to resolve the hostname.

traceroute parkshare-db-shard-00-01.wzbiv.mongodb.net: The trace shows the following:
PS C:\users\davel\github\parkshare\parkshare-backend> tracert parkshare-db-shard-00-01.wzbiv.mongodb.net
Tracing route to ec2-35-170-190-228.compute-1.amazonaws.com [35.170.190.228]
over a maximum of 30 hops:
1 3 ms 2 ms 3 ms CR1000A.mynetworksettings.com [192.168.1.1]
2 9 ms 4 ms 9 ms lo0-100.NYCMNY-VFTTP-419.verizon-gni.net [71.183.42.1]
3 7 ms 6 ms 5 ms G0-6-3-4.PITBPA-LCR-22.verizon-gni.net [100.41.196.242]
4 18 ms 14 ms 14 ms lag-1.ASBNVAEG-PPR02-CC.ALTER.NET [140.222.9.51]
5 20 ms 22 ms 41 ms 204.148.170.210
6 * * * Request timed out.
7 * * * Request timed out.
8 * * * Request timed out.
9 * * * Request timed out.
10 16 ms 14 ms 17 ms ec2-35-170-190-228.compute-1.amazonaws.com [35.170.190.228]
Trace complete.
PS C:\users\davel\github\parkshare\parkshare-backend>

Based on these findings, the issue seems related to a DNS resolution problem, possibly at the network level or with my internet service provider’s configuration.
I’d appreciate any guidance or suggestions the community can provide to help me resolve this MongoDB Atlas connection issue. Please let me know if you need any additional information from me.
Thank you for your assistance!

Seems like a DNS issue (as you’ve indicated). I have an article at querySrv errors when connecting to MongoDB Atlas | ALEX BEVILACQUA about swapping to legacy connection strings when the issue is SRV DNS query issues, but that doesn’t seem to be the problem you’re facing.

Maybe try an alternate DNS configuration on your Windows machine. You can use Cloudflare’s 1.1.1.1 (see Set up 1.1.1.1 on Windows · Cloudflare 1.1.1.1 docs) as one option to see if that addresses the issue on your machine.