Unable to connect to cluster using pymongo

Hi,

I’ve been using pymongo for a while and it’s been working flawlessly, until today. I am no longer able to connect to my cluster using pymongo, as I get the following error:

pymongo.errors.ServerSelectionTimeoutError: cluster: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

The only way I can get this to work is if I add the following argument on the MongoClient constructor ssl_cert_reqs=ssl.CERT_NONE

I haven’t modified the pymongo part of my application for a long time, and it still works perfectly fine when deployed on my server, but locally it doesn’t. Using Windows 10.

I would like to mention that I allowed my IP, and also tried by allowing all IPs.

And I am also able to connect using mongosh

Hi @Rosian_Pop!

This is probably something for the Drivers category, not developer tools, but either way I think it would help a lot if you could share both the full set of options (and connection string sans hostname/credentials) you use to connect to the server, both for pymongo and mongosh, and how they differ? If they don’t differ at all, what does the CA chain of your certificate look like?

Hey, they do not differ, for both I used the exact command/line of code gotten when you click the connect button on the cluster. As for the certificate, I am not sure as I did not touch that at all, everything being pretty much default.

It seems I’m getting this issue even in a clean python environment with just pymongo installed.

This looks like it’s related to another recent question (and answer): ServerSelectionTimeoutError [SSL: CERTIFICATE_VERIFY_FAILED] Trying to understand the origin of the problem - #2 by Shane

Hey, there. I’m using MongoDB 6.3 version and trying to connect my application to cluster using PyMongo, but unfortunately, getting this error; pymongo.errors.ServerSelectionTimeoutError:
All commands are correct. Please help me out. Thank You.