i am bit confused on how does the livekit auth wor...
# ask-ai
t
i am bit confused on how does the livekit auth work i see this for https://github.com/livekit-examples/python-agents-examples/blob/main/complex-agents/nova-sonic/form_agent.py
Copy code
^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1285, in _wrap_create_connection
    raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host goodfit-aolpgmbp.livekit.cloud:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1032)')]
what command should i run to debug/fix this issue
t
Thanks for reaching out, Atharva. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm sorry to hear you're running into the
ClientConnectorCertificateError
. This usually happens because of SSL certificate verification issues, but don’t worry—we can work through this together! • First, try upgrading the
certifi
package, which helps Python verify SSL certificates correctly:
Copy code
pip install --upgrade certifi
• Next, you can check which certificate file your Python environment is using by running:
Copy code
python -c 'import certifi; print(certifi.where())'
• If needed, reinstall your system’s
ca-certificates
to make sure it trusts widely recognized certificates. Also, please double-check that your LiveKit deployment is using an SSL certificate from a trusted certificate authority, since self-signed certificates won’t work for secure connections. If you have any questions or need more help, just let me know—I’m here for you! Sources: Authentication | LiveKit Docs | Web and mobile frontends | LiveKit Docs | Operational Guidance | livekit/livekit_composite | DeepWiki | Deploying LiveKit | LiveKit Docs | pkg/sip/tls.go
t
are you sure that this is a python error and not a livekit error?
t
I'm sorry to hear you're encountering the
ClientConnectorCertificateError
. This error isn't specific to LiveKit but comes from Python's HTTP client libraries like
aiohttp
when there's a hiccup with SSL certificate validation. It often happens if certificates are expired, self-signed, or not trusted in your Python environment. Here are some friendly steps to help you resolve this: • Try upgrading the
certifi
package to make sure your Python environment has the latest root certificates:
Copy code
pip install --upgrade certifi
• Double-check that your LiveKit server is using a valid SSL certificate issued by a trusted certificate authority. • If you want to dig a little deeper, you can use tools like
openssl s_client -connect your.livekit.domain:443
to inspect the certificate chain. If you’re still running into trouble, please don’t hesitate to share more details about your setup (like your Python version and how your LiveKit server is configured). I’m here to help you get this sorted out! Sources: Still Have Questions | ivr-nagivator/flask_livekit/errors.py | Development Tools | livekit/livekit_composite | DeepWiki | Connecting to LiveKit | LiveKit Docs | complex-agents/ivr-agent/flask_livekit/errors.py
t
pip3 install --upgrade certifi Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages (2025.8.3)
t
It looks like the
certifi
package is already up-to-date. To help you better, could you please share a bit more information? • The Python version you’re using (for example, 3.x.x). • Any other error messages or logs you’ve noticed after upgrading
certifi
. • Whether the LiveKit server you’re connecting to uses a custom or self-signed SSL certificate. With these details, I’ll be able to guide you more effectively and get this sorted out together.
t
python3 --version Python 3.13.7 and python3 form_agent.py dev 2025-09-30 160108,839 - DEBUG asyncio - Using selector: KqueueSelector 2025-09-30 160108,840 - DEV livekit.agents - Watching /Users/atharva/otherwise/livekit/python-agents-examples/complex-agents/nova-sonic 2025-09-30 160109,346 - DEBUG asyncio - Using selector: KqueueSelector 2025-09-30 160109,349 - INFO livekit.agents - starting worker {"version": "1.2.12", "rtc-version": "1.0.13"} 2025-09-30 160109,398 - WARNING livekit.agents - failed to connect to livekit, retrying in 0s Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1283, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1201, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ssl_shutdown_timeout=ssl_shutdown_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1234, in _create_connection_transport await waiter File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 581, in _on_handshake_complete raise handshake_exc File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 563, in _do_handshake self._sslobj.do_handshake() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ssl.py", line 951, in do_handshake self._sslobj.do_handshake() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1032) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/livekit/agents/worker.py", line 649, in _connection_task ws = await self._http_session.ws_connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<6 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 1067, in _ws_connect resp = await self.request( ^^^^^^^^^^^^^^^^^^^ ...<11 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 770, in _request resp = await handler(req) ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 725, in _connect_and_send_request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ req, traces=traces, timeout=real_timeout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 642, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1209, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1581, in _create_direct_connection raise last_exc File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1550, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1285, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host goodfit-aolpgmbp.livekit.cloud:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1032)')] 2025-09-30 160109,435 - WARNING livekit.agents - failed to connect to livekit, retrying in 2s Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1283, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1201, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ssl_shutdown_timeout=ssl_shutdown_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1234, in _create_connection_transport await waiter File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 581, in _on_handshake_complete raise handshake_exc File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 563, in _do_handshake self._sslobj.do_handshake() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ssl.py", line 951, in do_handshake self._sslobj.do_handshake() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1032) The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/livekit/agents/worker.py", line 649, in _connection_task ws = await self._http_session.ws_connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<6 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 1067, in _ws_connect resp = await self.request( ^^^^^^^^^^^^^^^^^^^ ...<11 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 770, in _request resp = await handler(req) ^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/client.py", line 725, in _connect_and_send_request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ req, traces=traces, timeout=real_timeout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 642, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1209, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1581, in _create_direct_connection raise last_exc File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1550, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<7 lines>... ) ^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1285, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host goodfit-aolpgmbp.livekit.cloud:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1032)')] 2025-09-30 160111,476 - WARNING livekit.agents - failed to connect to livekit, retrying in 4s Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/aiohttp/connector.py", line 1283, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs, sock=sock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1201, in create_connection transport, protocol = await self._create_connection_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... ssl_shutdown_timeout=ssl_shutdown_timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 1234, in _create_connection_transport await waiter File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 581, in _on_handshake_complete raise handshake_exc File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/sslproto.py", line 563, in _do_handshake self._sslobj.do_handshake() ~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ssl.py", line 951, in do_handshake ..... File to livekit, retrying in 6s ble to get local issuer certificate (_ssl.c:1032)')]
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
t
but are you sure that this is not related to my livekit cli setup?