Hi everyone,
I’ve been trying to connect to my MongoDB Atlas cluster using Mongoose, but I consistently get a ReplicaSetNoPrimary error. I’ve already checked and tried everything I could:
- My IP address is whitelisted
- Connection URI is correct with valid credentials
- No firewall, VPN, or antivirus is blocking the connection
- I’m using Node.js 18 and Mongoose 8
- I’ve tried from different networks and devices, still the same error
- Even created a new cluster — same result
Here’s the error I get:
MongoDB connection error: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted.
at _handleConnectionErrors (connection.js:1165:11)
…
reason: TopologyDescription {
type: ‘ReplicaSetNoPrimary’,
servers: Map(3) {
‘ac-kcup0yr-shard-00-00.fj1m4nm.mongodb.net:27017’ => [ServerDescription],
…
}
}
I’m not sure what else to try. Could it be an issue on Atlas’ side?
Thanks in advance for your help!