Error while running connection tests

I am facing the following issue while running the connection tests.


Seems the app is unable to connect to the db.
It pauses at tests/test_db_connection.py FFFF for quite some time and fails 4 times as indicated by the four Fs.

I have tried to connect using the shell and am able to do so with the same URI as in the .ini file.

Hi @Arunava_Pal

In terms of the FFFF error, can you confirm in your .ini file that you also edited second entry “MFLIX_DB_URI” in the “TEST” section and that this is also either the same as your Atlas URI or that it points to a running local mongod?

In terms of the TLS/SSL certificate errors, this appears to be a local machine issue with your machine and the certificates present. The best source of help in determining how to resolve PyMongo issues with TLS/SSL is this web page.

There is a known Python issue on Mac OS with versions of Python 3.6 or later, specifically the bug report is on this page and the resolution is to install updated root certificates.

Typically this command should resolve your issue:
open "/Applications/Python <YOUR PYTHON VERSION>/Install Certificates.command"

Please run the command listed in the previous paragraph. If that fails please refer to the PyMongo TLS/SSL web page for further assistance in terms of TLS/SSL issues.

Good luck and please let us known if this resolves your issue.

Kindest regards,
Eoin

1 Like

I rechecked my .ini file and both were updated. I tried running the command you suggested but that didn’t work. I got the following error.

I looked at the webpage and have changed the URI in the .ini file to the following

mongodb+srv://m220:m220Password@mflix.00xzg.mongodb.net/admin?tls=true

mongodb+srv://m220:m220Password@mflix.00xzg.mongodb.net/admin?tls=true&tlsAllowInvalidCertificates=true

Both did not work.

However, from the same virtual environment I am able to logon to the db using the shell and operate on it.

If it was a certificate error shouldn’t I get the same error while operating from the shell?

Hi @Arunava_Pal

Did you try this command with only 3.9.0 ? Can you confirm whether you tried it with 3.9 as your python version?

It’s good to hear that the MongoShell is connecting and it clearly indicates it is a certificate issue with your local Python environment and configuration.

There are some other possible suggestions in this Stackoverflow post that may assist you.

However, I suggest you try the script with only 3.9 not 3.9.0 as a first step before reviewing these alternative suggestions.

Kindest regards,
Eoin

Thank you 3.9 did the trick.

1 Like

That’s great @Arunava_Pal, enjoy the course and if you have any other issues or questions, please feel free to open a new topic to raise them.

Kindest regards,
Eoin