Ticket Connection SSL: CERTIFICATE_VERIFY_FAILED

Hi there,

On executing pytest -m connection i am getting the following error,

 pymongo.errors.ServerSelectionTimeoutError: mflix-shard-00-01-m5hjq.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)

Assistance appreciated, Thank you.

@Ayub_64513, can you connect to your cluster with the mongo shell?

Yes i can connect via mongo shell

Yes i can connect via mongo shell

Did you active the mflix anaconda environment?

The command is:

conda activate mflix

1 Like

Hi Steve, I am using virtualenv. I had used it for other courses so I decided to stick with it.

Have you set the same SECRET_KEY and URI for both [PROD] and [TEST] in your .ini file?

I was wondering about that. I have not changed the secret key i.e I have left it as i found it when I downloaded the file mflix-python.

1 Like

I changed both SECRET_KEY to the same value and both URI to the atlas cluster that I created earlier.

May be that’s why it is working here and not in your env.

Do you get the secret key from the cluster configuration/settings or can i put any key i please ?

So i googled and i found a post on stackoverflow,

https://stackoverflow.com/questions/40684543/how-to-make-python-use-ca-certificates-from-mac-os-truststore

macos - How to make Python use CA certificates
from Mac OS TrustStore? - Stack Overflow - Stack Overflow - Where Developers Learn, Share, & Build Careers

This is also a problem in Python 3.6 with MacOS Sierrra. I know your use case is different. But I stumbled upon this thread while investigating this problem.

So from the terminal i executed

/Applications/Python\ 3.7/Install\ Certificates.command

Now the tests are passing. I am getting an error when checking the status now but i will create another ticket.
Thank you for the help.

2 Likes

I created my own. I used letters and underscore only. I saw your next post and I want to let you know that I am running under Arch Linux.

1 Like

What is necessary to put in there? Thanks!!!

A string only known to you. I used my email address and replaced all special characters with underline.

1 Like

Thanks guys! This was exactly what I needed. I think its mandatory to do this if you stick with virtualenv. I also did not want to install conda. :slight_smile: