#Deepgram Websocket in Prod/Staging not working while local works

1 messages · Page 1 of 1 (latest)

halcyon pagoda
#

I'm encountering an issue where my streaming transcription integration works perfectly in my local development environment but fails in staging, despite using the exact same code and WebSocket setup.

In local, I use the wss://api.deepgram.com/v1/listen?model=nova-2&language=en-US&encoding=opus&punctuate=true&smart_format=true&interim_results=true endpoint. I receive transcript messages as expected. The Deepgram console logs show that the model is nova and the audio duration is greater than 0 seconds, with charges recorded.

In hosted staging branch, with the same code, I successfully establish the WebSocket connection and send audio chunks of about 1.9KB as binary messages. However, I receive no transcript messages. The Deepgram console shows the request using the base model and an audio duration of 0 seconds.

Both environments use the same MediaRecorder MIME type (audio/webm;codecs=opus) and browser (Chrome 137). The user agent string is identical. The WebSocket is authenticated and confirmed to be connected in both cases.

heavy oreBOT
#

Thanks for asking your question. Please be sure to reply with as much detail as possible so the community can assist you efficiently.
-# If you haven't done so, ensure your Discord and Github profiles are linked to Deepgram so you can earn points to redeem on cool stuff just by being active!

#

It looks like we're missing some important information to help debug your issue. Would you mind providing us with the following details in a reply?

  • The deepgram product you are using (e.g Speech to Text, Agent API)
  • A request ID that triggered your error or issue.
halcyon pagoda
#

I'm using Speech to Text and the two request IDs from the screenshots attached are: a82cd2ba-091a-4ee8-a624-82aabd61b705 and 0ca161d4-4322-4019-8fd4-ac4143ef9919

calm basinBOT
#

hey there, can you share the code? I notice it is using different tiers between your requests, I'd like to see why. That could be related

halcyon pagoda
#

Sure, but once again everything works locally, it is only when I deploy my code to a production environment do I not receive transcriptions back from Deepgram:

const configParams = new URLSearchParams({
            model: 'nova-2',
            language: language,
            encoding: 'opus',
            punctuate: 'true',
            smart_format: 'true',
            interim_results: 'true'
          });
          
          const deepgramUrl = `wss://api.deepgram.com/v1/listen?${configParams.toString()}`;
          const headers = {
            'Authorization': `Token ${this.apiKey}`
          };
          
          deepgramConnection = new WebSocket(deepgramUrl, {
            headers: headers
          });
#

This is a screenshot of my websocket messages in my Networks tab for local, and everything works perfectly

calm basinBOT
#

hey, I was about to ask for exactly that screenshot!

halcyon pagoda
#

This is a screenshot of my messages in my Networks tab for production, but I don't get an transcription messages back

calm basinBOT
#

what is your production environment? Vercel/Fly.io/etc?

halcyon pagoda
#

I'm using Azure web app

cloud pumice
#

oh oh, your language parameter. It is possible the language isn't supported on nova 2. are you capturing error events? although, I don't see one being sent in your screenshot

halcyon pagoda
#

No, I've tested the language parameter on local and it gets passed through properly

cloud pumice
#

sure, but is it possible it is coming through with a different value in production? have you tried hardcoding it? console logging it?

the reason i ask, is it is very odd that it is using a different model in your prod screenshot at the beginning, vs your local screenshot

#

also i have some suggestions about your auth but that wouldn't be affecting this

halcyon pagoda
#

No, it wouldn't come through as I different value in production. It is essentially hardcoded to 'en-US'. I was reading this discussion where someone seems to having a similar issue to me, but the solution is no help: https://github.com/orgs/deepgram/discussions/981

GitHub

I am trying to create the live transcriptions for the twilio call with the help of deepgram, the problem is I am not getting error, though I am not getting any transcriptions, it is giving me as my...

calm basinBOT
#

if it's "essentially hardcoded" i'd suggest going as far as hardcoding the entire URL completely static rather than the logic that builds the query string. If it repeats there, we'll have to dig into something else

halcyon pagoda
#

Sure, I’ll test it out tmw morning and lyk

halcyon pagoda
#

Can confirm that hard coding the entire URL still doesn't working in my staging/prod environments (still all works locally)

calm basinBOT
#

can you provide me request IDs of both?

halcyon pagoda
#

Yes, the two request IDs from the screenshots attached are: a82cd2ba-091a-4ee8-a624-82aabd61b705 and 0ca161d4-4322-4019-8fd4-ac4143ef9919

#

Here are the ones I just entered too:

  • Doesn't work (staging env): 3cd7d7a4-8a4f-4fcc-9fc9-7e3e6d7c32a8
  • Does work (local env): 0cd51f19-f291-4245-9676-f79241b82b4f
halcyon pagoda
#

Anymore suggestions @cloud pumice