ServerSelectionTimeoutError, managed Mongo DB instance

Hi guys, so I’m using a managed Mongo DB instance for our staging env, basically it’s a Mongo atlas connected over VPC, but i keep getting occasional ServerSelectionTimeoutError, it starts working smoothly at some point, but then if i make a new push and redeploy my server, it seems then the machine becomes unable to connect to the db and hence the ServerSelectionTimeoutErrorwhich seems to then resume working after some time, will be glad for any pointers on how to solve this.

Is it happening all the time? Does it happen because your app just restart?

Yes, all the time, when it works and then i have to push an update and my app redeploys, it starts happening again.

EDIT: could this be an issue with my setup bcause if i allow request from all origin to my mongo atlas DB, everything works!

pymongo.errors.ServerSelectionTimeoutError: cluster0-shard-00-02.mghyr.mongodb.net:27017: timed out,cluster0-shard-00-01.mghyr.mongodb.net:27017: timed out,cluster0-shard-00-00.mghyr.mongodb.net:27017: timed out, Timeout: 30s, Topology Description: ,

I do think this issue is an application issue on your side. What MongoDB client do you use? Any ORM? What’s the configuration? You might check those elements.

1 Like

Hi, Thanks for your responses, fixed the issue, didn’t set my route table properly on aws.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.