Following up from my previous post.
I’m still stuck with the occasional ReplicaSetNoPrimary errors. Quite rare but it does happen.
ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"MongoServerSelectionError: Server selection timed out after 30000 ms","reason":{"errorType":"MongoServerSelectionError","errorMessage":"Server selection timed out after 30000 ms","reason":{"type":"ReplicaSetNoPrimary","servers":{},"stale":false,"compatible":true,"heartbeatFrequencyMS":10000,"localThresholdMS":15,"
.
This is despite upgrading to a dedicated M10 cluster. My application barely has any traffic so I’m confused why it sometimes can’t seem to connect?
My setup is still the same:
- My connection string is valid.
- The network connection is stable.
- retryWrites=true
- w=majority
- Allowed all IPs
- All errors are caught.
- I use the Mongo Node Driver version 5.7.0
- My stable connections have been stably hovering around a relatively low number (see scree
nshot).
It’s frustrating not knowing why this is happening despite setting everything up correctly, and it’s connecting properly most of the time.
Random, unpredictable errors of unknown cause are unsettling so if someone has insight, please share.