-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: Authentication
-
None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
When connecting to the Atlas proxy to talk to the flex tier, if the IP is not whitelisted, TLS times out. mongosh detects and prints a helpful suggestion to check the IP whitelist. It could be handy for the Python library to follow suit.
$ mongosh <URL> ... MongoServerSelectionError: 80D8DDE3AF7F0000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1605:SSL alert number 80 . It looks like this is a MongoDB Atlas cluster. Please ensure that your Network Access List allows connections from your IP.
>>> import pymongo.mongo_client # type: ignore
>>> import pymongo.server_api # type: ignore
>>> mongo_uri = "mongodb+srv://goodi:#######@goodi.xqjjoqv.mongodb.net/?retryWrites=true&w=majority&appName=goodi"
>>> mongo_api = pymongo.server_api.ServerApi("1")
>>> client = pymongo.mongo_client.MongoClient(mongo_uri, server_api=mongo_api)
>>> db = client.get_database("exercism_discord")
>>> collection = db.get_collection("pinned_messages")
>>> collection.find_one()
[...]
pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: ac-qmutecg-shard-00-00.xqjjoqv.mongodb.net:27017: [SSL: TLSV1_ALERT_INTERNAL_ERROR] tlsv1 alert internal error (_ssl.c:1028)