deepgram / deepgram-js-sdk

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

Increase in `UND_ERR_HEADERS_TIMEOUT` errors #243

Closed mosnicholas closed 6 months ago

mosnicholas commented 9 months ago

What is the current behavior?

In periods of high load, response times fluctuate. If they go over 5' mark, the fetch library implemented fails, because it cannot stay alive for longer than 5'. Those timeouts are also not configurable.

This is a known limitation of the fetch library implemented.

Steps to reproduce

It's ad-hoc and depends on response rates & usage of Deepgram's servers

Expected behavior

That we don't see timeout issues and can configure timeout values if needed.

Please tell us about your environment

This is from calls made server side

Other information

Screenshot 2024-01-30 at 9 04 32 AM

jjmaldonis commented 9 months ago

Dropping thoughts from an internal convo:

Below are the workarounds:

  1. Create a server to receive asynchronous requests via a callback URL.
    1. This is DG's recommended approach because you'll have a more robust system that is less sensitive to issues like these.
    2. But it requires significant engineering work to get up and running, and changes to your code are required.
  2. Downgrade to the JS SDK v2.
    1. We don't recommend this because the v2 SDK will have limited supported going forward. For example, DG's new Speech Intelligence and TTS features will not be supported.
    2. This is a smaller engineering effort and will likely resolve the 5 minute maximum timeout.
    1. Patch the v3 SDK and submit a PR so DG can merge it and give you the functionality you want.
    2. This would be awesome! We'd love a contribution.
    3. But it's more engineering effort for you.
  3. Wait for DG to update the v3 SDK.
    1. Currently this isn't at the top of our priority list, but if other projects go smoothly we could get it done.
    2. But you have to wait to get the improvement.

This is what we've found out about the issue, and these are the constraints involved:

lukeocodes commented 6 months ago

the solution #245 has now provided the ability to override fetch with a custom fetch interface