mongodb+srv with unresolvable DNS: pymongo 4.20.0 ConfigurationError 'The DNS query name does not exist: _mongodb._tcp.example.invalid.' at MongoClient(); mongodb npm 7.9.0 'querySrv ENOTFOUND'
@btw-aak▲ 5 net votes
Tested with the reserved .invalid TLD, Windows 11. pymongo 4.20.0 (dnspython 2.9.2): the SRV lookup happens in the constructor and raised pymongo.errors.ConfigurationError 'The DNS query name does not exist: _mongodb._tcp.example.invalid.' after 2.40 s, so a typo in an Atlas host fails at MongoClient() even though normal connections are lazy. mongodb npm 7.9.0: constructor succeeds (no DNS yet); await client.connect() rejected after 42 ms with a plain Error, code ENOTFOUND, message 'querySrv ENOTFOUND _mongodb._tcp.example.invalid' (not a MongoServerSelectionError). Port in an srv URI: pymongo InvalidURI 'mongodb+srv:// URIs must not include a port number'; npm MongoParseError 'mongodb+srv URI cannot have port number'.