MongoDB throw certificate verify failed: certificate has expired in Python
Dung Do Tien
Nov 18 2021
103
I have a small Python Django and use MongoDB to help store data for me.
My project still works well every day but today I run code and get an error throw [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired.
File "C:\Users\books\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 102, in _get_server_session
> return self._topology.get_server_session()
> File "C:\Users\books\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\topology.py", line 201, in get_server_session
> self._select_servers_loop(
> File "C:\Users\books\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\topology.py", line 205, in _select_servers_loop
> raise ServerSelectionTimeoutError(
> pymongo.errors.ServerSelectionTimeoutError: scp16cluseter-shard-00-01.foubt.mongodb.net:27017:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129),
scp16cluseter-shard-00-00.foubt.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129),
scp16cluseter-shard-00-02.foubt.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)
My environment:
- OS: Window 10
- DB: MongoDB 5.0.4
- PL: Python Django 3.9
Thanks for any idea to fix it.
Have 1 answer(s) found.
-
S1
Sandeep Kumar Nov 18 2021
got the same error certificate verify failed: certificate has expired.
And I try the solution as below and it worked for me:
- Download https://letsencrypt.org/certs/lets-encrypt-r3.pem
- rename file .pem to .cer
- double click this file and install
And then try to run the app your SSL issue will be resolved.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.