For some reason, I’m receiving this error when connecting to my MongoDB in replit. It was all working fine like 8 hours ago, and been connecting with it for 2 weeks now.
Error:
MongoServerSelectionError: getaddrinfo ENOTFOUND ac-8q8dm3y-shard-00-00.5ldtt3z.mongodb.net
at Timeout._onTimeout (/home/runner/Bojji/node_modules/mongodb/lib/sdam/topology.js:292:38)
at listOnTimeout (node:internal/timers:557:17) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'primary' => [ServerDescription],
'secondary' => [ServerDescription],
'secondary' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-q5c7wq-shard-0',
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined,
[Symbol(errorLabels)]: Set(0) {}
}
Here’s my connection string:
mongodb+srv://myusername:mypassword@cluster0.5ldtt3z.mongodb.net/mydb?retryWrites=true&w=majority
Here are the things I tried but to no avail:
- Used Google DNS.
- Added 0.0.0.0/0 IP Whitelist
- Added my IP in whitelist
- Disabled Windows Defender
- Updated my Mongo User password.
- Restarted my router 3x.
- Used mobile data.
- Allow outbound port 27015-27017 in firewall
Here are other information:
Mongodb Cluster version: 5.0.14
Mongodb Cluster Tier: M0 Sandbox (General)
Mongodb type: Replica Set - 3 nodes
Mongodb Package version: 4.13.0
Windows OS: Windows 11
More information:
I can connect and query just fine in MongoDB Compass. It happens in replit.