ERROR - Cannot connect to host api-gateway.instructure.com:443 ssl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to configure DAP client on a new Windows server, followed all the instructions as per the documentation.
When trying to fetch the list of tables using "dap list --namespace canvas", I got the below errors. Any help in resolving this error is really appreciated.
Thank you.
C:\Users\attilisatish>dap list --namespace canvas
2024-01-04 12:58:57,814 - ERROR - Cannot connect to host api-gateway.instructure.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')]
Traceback (most recent call last):
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 992, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1112, in create_connection
transport, protocol = await self._create_connection_transport(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 1145, in _create_connection_transport
await waiter
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\sslproto.py", line 575, in _on_handshake_complete
raise handshake_exc
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\sslproto.py", line 557, in _do_handshake
self._sslobj.do_handshake()
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 979, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\__main__.py", line 133, in console_entry
main()
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\__main__.py", line 125, in main
asyncio.run(dapCommand.execute(args))
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\commands\commands.py", line 31, in execute
executed = await super().execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\commands\base.py", line 49, in execute
if await subcommand.execute(args):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\commands\base.py", line 45, in execute
await self._execute_impl(args)
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\commands\commands.py", line 153, in _execute_impl
tables = await session.get_tables(args.namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\api.py", line 398, in get_tables
table_list = await self._get(f"/dap/query/{namespace}/table", TableList)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\api.py", line 213, in _get
await self.authenticate()
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\api.py", line 363, in authenticate
properties = await self._post_auth_request(self._credentials.basic_credentials)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\dap\api.py", line 308, in _post_auth_request
async with self._session.post(
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\client.py", line 1187, in __aenter__
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\client.py", line 574, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 911, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 1235, in _create_direct_connection
raise last_exc
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 1204, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\attilisatish\AppData\Local\Programs\Python\Python311\Lib\site-packages\aiohttp\connector.py", line 994, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api-gateway.instructure.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')]
Thank you,
Satish
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a solution I got that worked for me in our all 3 environments (DEV, TEST, and PROD).
In our case, our existing running environment was:
Python 3.10.10
Pip 22.x.x
Dap 0.3.10
After getting the error, I have found that dap client was yanked. So I have updated pip, dap client and postgresql:
python -m pip install --upgrade pip
pip install --upgrade instructure-dap-client
pip install --upgrade "instructure-dap-client[postgresql,mysql]"
Even though I was getting the same SSL certificate error.
Then I followed the below steps to update the certificate:
- pip install --upgrade certify
- I am in Windows, so I have updated my local certificate as below.
- Using Git Bash, I got the certificate details of the Canvas API gateway:
openssl s_client -connect api-gateway.instructure.com:443
-
Copy the certificate from
-----BEGIN CERTIFICATE-----
To
-----END CERTIFICATE-----
And save the file as .crt
-
Now update the local certificate.
- Open Certificate Manager:
- Press Windows + R
- Type certlm.msc
- Click OK/Run as Administrator
7. Navigate to Certificates:
- Expand "Trusted Root Certification Authorities"
- Click on "Certificates"
8. To Import New Certificates:
- Right-click on "Certificates"
- Select "All Tasks" → "Import"
- The Certificate Import Wizard will open
- Click "Next"
- Browse to locate your certificate file (.cer, .crt, or .pem)
- Follow the wizard steps
And the issue got resolved.