ServerSelectionTimeoutError [SSL: CERTIFICATE_VERIFY_FAILED] Trying to understand the origin of the problem

By default pymongo relies on the operating system’s root certificates.

But I find this problem odd, why today?

It could be that Atlas itself updated its certificates or it could be that something on your OS changed. “certificate verify failed” often occurs because OpenSSL does not have access to the system’s root certificates or the certificates are out of date. For how to troubleshoot see TLS/SSL and PyMongo - PyMongo 4.6.2 documentation

Also please note that “ssl_ca_certs” is deprecated and you should use “tlsCAFile” instead:

client = pymongo.MongoClient(connection, tlsCAFile=certifi.where())
9 Likes