fix(aws): restore Transcribe STT on transcribe-streaming 0.11 - #7094
Merged
Conversation
aws-sdk-transcribe-streaming 0.10.0 dropped the Config export and 0.11.0 dropped the TranscribeStreamingClient alias, so the plugin import failed and STT() raised a misleading "package is not installed" ImportError. 0.11.0 also makes AIOHTTPClient the default transport, which cannot carry a bidirectional stream. StartStreamTranscription is bidirectional, so the SpeechStream's AWSCRTHTTPClient is now passed as transport= and closed once in aclose().
davidzhao
approved these changes
Sep 2, 2026
The stream shared one AWSCRTHTTPClient across restarts, so a restarted attempt reused the pooled HTTP/2 connection of the stream that AWS had already finished on its idle timeout. StartStreamTranscription then carried no audio and raised nothing, so the session went silent after the first 15 seconds of quiet. Build the transport per attempt and close the previous one when the loop restarts. Closing at the top of the next iteration rather than the end of the current one matters: a close after `await gather_future` is skipped, because CancelledError escapes the surrounding contextlib.suppress(Exception). Verified against live Transcribe on transcribe-streaming 0.11.0. Both attempts transcribe across a restart, and the last transport closes on aclose. Replace test_aws_stream_pins_the_crt_transport, which asserted on a single attempt and could not see this, with a test that drives a real restart through the idle-timeout BadRequestException.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: AWS Transcribe STT cannot start on
aws-sdk-transcribe-streaming0.10.0 or later. 0.10.0 dropped theConfigexport and 0.11.0 dropped theTranscribeStreamingClientalias, so the module import fails andSTT()raises a misleadingImportError: The 'aws_sdk_transcribe_streaming' package is not installed.Fix: Raise the floor to 0.11.0, import
AsyncTranscribeStreamingClientandAsyncTranscribeStreamingConfigdirectly, and build the config withawait Config.resolve(...). 0.11.0 makesAIOHTTPClientthe default transport, which cannot carry a bidirectional stream, soStartStreamTranscriptionnow gets the SpeechStream'sAWSCRTHTTPClientthroughtransport=, closed once inaclose().Replaces #7074, whose transport diagnosis this keeps. Close #7072.
Context for reviewing and coding agents