deepgram / deepgram-js-sdk

Official JavaScript SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
127 stars 45 forks source link

More Verbose Websocket Errors #267

Open joshraymo opened 2 months ago

joshraymo commented 2 months ago

Proposed changes

Hello! I made a post on the discord but was prompted to open an issue so here I am! I am currently attempting to implement a live transcription with Deepgram and Ably but am unable to make a connection to the Deepgram api.

However, I have had an incredibly hard time debugging the issue because the error that is returned from the api is not verbose, and as such, makes it very hard to tell what the issue actually is. I've been stuck on this for a few days now and unfortunately am having a hard time seeing a path forward

If you could make the errors more descriptive, including an error code and message that would be amazing, because as it stands it's very hard to figure out what is wrong. I've included a screenshot of the error and relevant code, as well as a link to the original post on discord Screenshot 2024-04-21 134815 Screenshot 2024-04-21 140616

https://discord.com/channels/1108042150941294664/1231667143393673246

lukeocodes commented 2 months ago

There is an issue with the websocket package we're using, whereby it suppresses the connection errors and just emits an error. Very frustrating! I'm looking to replace it entirely with our own isomorphic code for browser/server websockets, which should give us a lot of improvements across the board

Might take me a couple of weeks to get to this

skitsanos commented 2 weeks ago

Any progress on this one? I have the same issue - I need help figuring out why the error occurs.

import {createClient, LiveTranscriptionEvents} from '@deepgram/sdk';

const deepgramClient = createClient(process.env.DEEPGRAM_API_KEY ?? '');

const deepgram = deepgramClient.listen.live({
        smart_format: true,
        model: 'nova-2'
    });

deepgram.on(LiveTranscriptionEvents.Error, error =>
    {
       console.error('Unknown error:', error);
    });

...

It just fires an error directly.