Client connection timeout

Something new going on here. Local node scripts all of a sudden can’t connect to either my staging or prod db’s.

Nothing db-related in our back end has changed except updating the mongodb nodejs driver to 6.x.x (was not the culprit).

Local scripts can still hit the local dev env db fine, and Compass can still connect to staging/prod fine. So i am at a loss at what all of a sudden has changed to cause timeout issues when attempting to connect to Atlas via the mongodb MongoClient.

Any suggestions?..

Hey @Chris_Esperian,

As this comes up occasionally I’ve written about it in more detail at querySrv errors when connecting to MongoDB Atlas | ALEX BEVILACQUA.

The TL;DR is this is a DNS query timing out so the seed list of server the MongoClient needs to connect to isn’t being retrieved. You can work around this by just using the legacy mongodb:// connection string for your cluster instead of the mongodb+srv:// variation.

Hey, Alex. Thanks for weighing in! That was an interesting suggestion, but now I am getting ENOTFOUND errors. I’m just now looking into this new development, so any further suggestions would be appreciated…

Update; the planets must have all moved back out of alignment, it seems, because today my scripts can successfully connect using the same mongodb+srv string that they’ve been using previously. SMH.

Thanks for that link, it’s an interesting read, and i’ll make sure to keep it handy for future reference.

Cheers!

Hey Chris,

These DNS failures tend to be transient which is why I proposed DRIVERS-2757 to try to automatically retry on these types of failures. This is something we hope to tackle after doing some additional research to make sure we’re solving the right problem in these situations :slight_smile: