I'm developing a small discord bot that uses pymongo (MongoDB). When I run my code locally throws an error, when I run my code in VPS it works with no error I'm on windows 10.
Traceback (most recent call last):
File "c:\Users\Yas_!_ru\Documents\GitHub\Mindustry Ranked\main.py", line 12, in <module>
init_db()
File "c:\Users\Yas_!_ru\Documents\GitHub\Mindustry Ranked\utils\DBUtils.py", line 113, in init_db
DBUtils.settings = get_settings(DBUtils.db)
File "c:\Users\Yas_!_ru\Documents\GitHub\Mindustry Ranked\utils\DBUtils.py", line 120, in get_settings
db_settings = settings_collection.find({'name': 'production'}).next()
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\cursor.py", line 1207, in next
if len(self.__data) or self._refresh():
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\cursor.py", line 1100, in _refresh
self.__session = self.__collection.database.client._ensure_session()
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 1816, in _ensure_session
return self.__start_session(True, causal_consistency=False)
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 1766, in __start_session
server_session = self._get_server_session()
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 1802, in _get_server_session
return self._topology.get_server_session()
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\topology.py", line 490, in get_server_session
self._select_servers_loop(
File "C:\Users\Yas_!_ru\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\topology.py", line 215, in _select_servers_loop
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: cluster0-shard-00-01.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129),cluster0-shard-00-02.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129),cluster0-shard-00-00.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129), Timeout: 30s, Topology Description: <TopologyDescription id: 60a39fb36200a62d85a9620b, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('cluster0-shard-00-00.mrf1p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-00.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>, <ServerDescription ('cluster0-shard-00-01.mrf1p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-01.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>, <ServerDescription ('cluster0-shard-00-02.mrf1p.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-02.mrf1p.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')>]>
Installing this certificate solved the issue https://crt.sh/?id=4536904705