Błąd na backendzie
Mam prosty backend (kilka endpointów) na vercelu. Co jakiś czas w logach pojawia mi się poniższy błąd.
Powoduje on że api nagle przestaje działać i nie mogę odczytać treści w jsonie dla endpointu.
Powoduje mi to takie problemy że aplikacja raz działa a raz nie działa.
Zaczyna nie działać właśnie po tym jak pojawia się błąd.
Być może dla kogoś doświadczonego to będzie prosta sprawa do rozwiązania - nie wiem.
Próbowałem pozmieniać ip na mongo na 0.0.0.0/0 żeby można było wchodzić z wszystkich IP, niestety błąd dalej się pojawia.
Błąd z logów:
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. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/
at _handleConnectionErrors (/var/task/node_modules/mongoose/lib/connection.js:1165:11)
at NativeConnection.openUri (/var/task/node_modules/mongoose/lib/connection.js:1096:11)
at runNextTicks (node:internal/process/task_queues:65:5)
at listOnTimeout (node:internal/timers:549:9)
at process.processTimers (node:internal/timers:523:7) {
errorLabelSet: Set(0) {},
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-jelx6hf-shard-00-02.glqfx1v.mongodb.net:27017' => [ServerDescription],
'ac-jelx6hf-shard-00-00.glqfx1v.mongodb.net:27017' => [ServerDescription],
'ac-jelx6hf-shard-00-01.glqfx1v.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-11776b-shard-0',
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined,
cause: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-jelx6hf-shard-00-02.glqfx1v.mongodb.net:27017' => [ServerDescr