a year ago
I recently migrated my app from AWS ECS where I noticed no downtime with my mongodb connections, but my deployment (Nestjs) on Railway fails due to the following error (after a long idle period)
```
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Server selection timed out after 30000 ms
at new MongoError (/app/node_modules/mongodb/lib/error.js:111:9)
at new MongoSystemError (/app/node_modules/mongodb/lib/error.js:1014:13)
at new MongoServerSelectionError (/app/node_modules/mongodb/lib/error.js:1044:9)
at <anonymous> (/app/node_modules/mongodb/lib/sdam/topology.js:303:50)
at processTicksAndRejections (:12:39)
```
other times with the following:
```
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Server selection timed out after 30000 ms
at new MongoError (/app/node_modules/mongodb/lib/error.js:111:9)
at new MongoSystemError (/app/node_modules/mongodb/lib/error.js:1014:13)
at new MongoServerSelectionError (/app/node_modules/mongodb/lib/error.js:1044:9)
at <anonymous> (/app/node_modules/mongodb/lib/sdam/topology.js:303:50)
at processTicksAndRejections (:12:39)
```
Note:
1. My IP on mongodb atlas is set to allow from anywhere
I have 3 services connecting to the same db/cluster
My redis db (from Upstash) does not experience this same issue.
0 Replies