Hello,
I’m using MongoDB Atlas since a few days in my Node.js API with mongodb version 4.8.
Till now I haven’t encountered any issues connection to the mongo server, but all of a sudden I keep getting this error:
MongoServerSelectionError: Server selection timed out after 30000 ms
at Timeout._onTimeout (<path>\node_modules\mongodb\src\sdam\topology.ts:570:30)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'<username>-shard-00-00.xocdc.mongodb.net:27017' => [ServerDescription],
'<username>-shard-00-02.xocdc.mongodb.net:27017' => [ServerDescription],
'<username>-shard-00-01.xocdc.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: '<set-name>',
logicalSessionTimeoutMinutes: undefined
},
code: undefined,
[Symbol(errorLabels)]: Set(0) {}
}
I’m sure my connections are setup correctly. I’ve whitelisted all IPs, so the problem can’t be there. Does anyone have a clue what causes this error?