-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Summary
I encountered this issue in a high-traffic production environment during a period of DNS instability. When a DNS resolution failed, the process crashed with the following error, but because the connection Promise never rejected, the application was unable to catch or handle the exception gracefully:
uncaughtException: Error: getaddrinfo ENOTFOUND streaming.assemblyai.com
Description
The current implementation of StreamingTranscriber.connect() returns a Promise that only settles (resolves) upon receiving a Begin message. If the connection fails before this message arrives, the Promise remains pending indefinitely.
This creates a "black hole" in the application logic where await transcriber.connect() never completes, making it impossible to handle network issues using standard try/catch blocks or automated retry logic.
The Problem
There are some scenarios where the Promise currently hangs:
- DNS/Transport Errors: If a
ENOTFOUNDorECONNREFUSEDoccurs,onerrorfires, but the Promise is never rejected. - Premature Closure: If the server drops the connection (e.g., a 4xx/5xx proxy error) before the
Beginevent,onclosefires, but the Promise stays pending.