Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocketException with SSL (CERTIFICATE_VERIFY_FAILED) while starting Deepgram listen #12

Open
willywongi opened this issue Jul 24, 2024 · 2 comments

Comments

@willywongi
Copy link

willywongi commented Jul 24, 2024

I just cloned this repo and couldn't make it work. I tried updating the deepgram-sdk from v3.3.2 to v3.4.0; also, I'm using deepgram.listen.websocket instead of deepgram.listen.live after seeing a deprecation warning.

The socketIO server reports an SSL error. I managed to reproduce it:

import os
import logging

from deepgram import (
    DeepgramClient,
    LiveTranscriptionEvents,
    LiveOptions,
    DeepgramClientOptions
)
from dotenv import load_dotenv

API_KEY = os.getenv("DEEPGRAM_API_KEY")
config = DeepgramClientOptions(
    verbose=logging.DEBUG,
    options={"keepalive": "true"}
)
deepgram = DeepgramClient(API_KEY, config)
dg_connection = deepgram.listen.websocket.v("1")
options = LiveOptions(model="nova-2", language="en-US")
dg_connection.start(options)

The dg_connection.start invocation reports False and this error is logged:

WebSocketException in ListenWebSocketClient.start: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

The DEBUG option doesn't add much to the error.

MacOS Sonoma 14.5 (23F79), Python 3.12.3.

@davidvonthenen
Copy link
Contributor

hi @willywongi

If you're using macOS go to Macintosh HD > Applications > Python3.X folder (or whatever version of python you're using) > double click on "Install Certificates.command" file.

@willywongi
Copy link
Author

Ciao @dvonthenen, thank you very much, you drove me to the right place to understand the problem.

I didn't feel like to mess with the CA system files, so I found this alternative:

import os
import certifi

os.environ["SSL_CERT_FILE"] = certifi.where()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants