-
Notifications
You must be signed in to change notification settings - Fork 643
Open
Labels
feature-requestNew feature or enhancement. May require GitHub community feedback.New feature or enhancement. May require GitHub community feedback.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
Describe the feature
Problem
When using @aws-sdk/client-transcribe-streaming with expired credentials, an ERR_STREAM_PREMATURE_CLOSE error is thrown in a callback context that cannot be caught by try/catch, promise handlers, or stream error listeners. This causes an unavoidable Node.js process crash.
Impact
Impossible to build resilient production applications when stream errors crash the entire server instead of allowing graceful error handling.
Originating file
@aws-sdk/[email protected]/dist-cjs/index.js:89
stream.pipeline(payloadStream, signingStream, request.body, (err) => {
if (err) {
throw err; // ⚠️ Throws in callback, bypasses all error handling
}
});Reproduction
- Create
TranscribeStreamingClientwith expired credentials - Start streaming with
StartStreamTranscriptionCommand - Observe uncaught exception crash
Current Workaround
process.on('uncaughtException', (error: Error) => {
if ((error as any).code === 'ERR_STREAM_PREMATURE_CLOSE') {
console.error('Stream error:', error)
return // Prevent crash
}
throw error
})Use Case
Impossible to build resilient production applications when stream errors crash the entire server instead of allowing graceful error handling.
Proposed Solution
- Use promises or event emitters instead of killing the raw stream like this.
- On the thrown error, add
error.source = '@aws-sdk/eventstream-handler-node'for identification - Document that
process.on('uncaughtException')is required
Other Information
@aws-sdk/[email protected]- Node.js v23.9.0
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
"@aws-sdk/client-transcribe-streaming": "^3.917.0",
Environment details (OS name and version, etc.)
Node.js v23.9.0, Mac OS 15.6.1
Metadata
Metadata
Assignees
Labels
feature-requestNew feature or enhancement. May require GitHub community feedback.New feature or enhancement. May require GitHub community feedback.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.