Hi,
I’m having an issue connecting to my Atlas cluster in a Jupyter notebook. When I run a query, I receive the following traceback:
ServerSelectionTimeoutError: cluster0-shard-00-02.wapdt.mongodb.net:27017: [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
(_ssl.c:1045),cluster0-shard-00-01.wapdt.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate (_ssl.c:1045),cluster0-shard-00-
00.wapdt.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to
get local issuer certificate (_ssl.c:1045), Timeout: 30s, Topology Description: <TopologyDescription id:
6090ddc81b3959247ae64e09, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription
('cluster0-shard-00-00.wapdt.mongodb.net', 27017) server_type: Unknown, rtt: None,
error=AutoReconnect('cluster0-shard-00-00.wapdt.mongodb.net:27017: [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
(_ssl.c:1045)')>, <ServerDescription ('cluster0-shard-00-01.wapdt.mongodb.net', 27017) server_type:
Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-01.wapdt.mongodb.net:27017: [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
(_ssl.c:1045)')>, <ServerDescription ('cluster0-shard-00-02.wapdt.mongodb.net', 27017) server_type:
Unknown, rtt: None, error=AutoReconnect('cluster0-shard-00-02.wapdt.mongodb.net:27017: [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
(_ssl.c:1045)')>]>
This is what my MongoClient initialization looks like:
uri = 'mongodb+srv://xxx:yyy@cluster0.wapdt.mongodb.net/shopalot?
retryWrites=true&w=majority'
client = MongoClient(uri, tls=True, tlsCAFile=certifi.where())
I’ve tried all possible steps at TLS/SSL and PyMongo — PyMongo 4.3.3 documentation (including running the “Install Certificates.command”) and ensured that my IP address is whitelisted in Atlas. I also tried setting tlsAllowInvalidCertificates to True and I somehow still get the same error.
I am able to connect to my cluster through MongoDB Compass but I still do need to find a way to be able to run my Jupyter notebook.
What am I missing here?
Thank you for any help you can offer!