Azure/azure-cosmos-python

synchronized_request.py throws SSLError if I work with a DocumentDB emulator.

Closed this issue · 3 comments

pydocumentdb throws SSLError if I work with a DocumentDB emulator. synchronized_request.py checks if users work with a local emulator or not. But the code checking the host is not correct.

At the line 100 of synchronized_request.py,
is_ssl_enabled = (parse_result.hostname != 'localhost')
this compares the host is localhost or not. However, parse=result.hostname returns 127.0.0.1 hence requests module verifies SSL certification and throws SSLError.

My environment is following:
Windows 10 professional
Python 3.6 (Anacoda3)

@daigok Can you export the emulator certificate using instructions in https://docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator-export-ssl-certificates and then add set the following environment variable to the location of the certificate. let me know if that resolves the issue.
os.environ["REQUESTS_CA_BUNDLE"] = "C:/localhost.cer"

We will work on exposing this option on the SDK itself, so that you can disable it that way.

@daigok We will be releasing a fix for this issue next week.

This has been fixed in the Python SDK 2.1.0 release. Please set DisableSSLVerification property on ConnectionPolicy object to turn off SSL verification when connecting to emulator.