I keep getting this error “pymongo.errors.ServerSelectionTimeoutError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108),”.

I have created a project using Pymongo and flask. My python SSL certificates seem to be up to date. I tried following the last solution to this error, but it was not very clear to me. If anyone can please assist with a solution to this problem it would be appreciated.


Hey @Guy_De_La_Cruz,

Welcome to the MongoDB Community Forums! :leaves:

This error mostly means that the validation issue is on the client-side of the connection, and not the server. Your local trust stores do not contain the new root certificate required for verification. For more information, do see: Which certificate authority signs MongoDB Atlas cluster TLS certificates and TSL/SSL and PyMongo

Now, as a first step, can you please let us know which OS you are using as well as the python version on your system and try the steps mentioned in this post, and let us know if all these check-out or not, ie.

  • You are able to connect with Atlas from shell directly
  • check that dnspython, pymongo and certifi are installed in your system/environment
  • revisiting your local machine OS and its certificates and checking that they are up-to-date. One thing I recommend trying: