aws / amazon-kinesis-video-streams-parser-library

Amazon Kinesis Video Streams parser library is for developers to include in their applications that makes it easy to work with the output of video streams such as retrieving frame-level objects, metadata for fragments, and more.
Apache License 2.0
103 stars 52 forks source link

Setting AsynchClient to use Proxy Leads to issues #132

Closed chrisfabri closed 11 months ago

chrisfabri commented 2 years ago

Creating an SdkAsyncHttpClient in order to set the proxy client leads to failed transcription requests.....

I need to execute the HTTP2 call

against a corporate proxy to access the realtime streaming transcribe endpoint. The existing code doesn't use any https_proxy or no_proxy values to set the proxy for HTTP2 calls (though it does do so for HTTP1.1 calls).

In the TranscribeStreamingHandler class, I've created an a new client, with the proxy settings that I need. and am then passing that client into TranscribeStreamingRetryClient

_SdkAsyncHttpClient httpClient = NettyNioAsyncHttpClient.builder().proxyConfiguration(proxyConfiguration).build(); transcribeStreamingRetryClient = new TranscribeStreamingRetryClient(httpClient, _AwsCredentialsProviderV2, TRANSCRIBE_ENDPOINT, REGION,awsCloudWatchProxy);

I added a slightly modified retry client constructor - hard to read - but it adds the client as part of the builder sequence.

_public TranscribeStreamingRetryClient(SdkAsyncHttpClient sdkAsyncHttpClient_, AwsCredentialsProvider creds_, String endpoint_, Regions region_, AWSCloudWatchProxy awsCloudWatchProxy_) throws URISyntaxException {        this(TranscribeStreamingAsyncClient.builder()**.httpClient(sdkAsyncHttpClient_).**credentialsProvider(creds_).overrideConfiguration(c -> c.putAdvancedOption(SdkAdvancedClientOption.SIGNER, EventStreamAws4Signer.create())).endpointOverride(new URI(endpoint_)).region(Region.of(region_.getName())).build(), awsCloudWatchProxy_);
}_

Whether due to the lack of correct settings on the client or bc of the proxy perhaps, the call to transcribe now fails with the following error:

java.util.concurrent.CompletionException: software.amazon.awssdk.services.transcribestreaming.model.BadRequestException: A complete signal was sent without the preceding empty frame. (Service: transcribe, Status Code: 400, Request ID: 81df4440-c71c-4520-b1b8-863356843a76, Extended Request ID: null) at software.amazon.awssdk.utils.CompletableFutureUtils.errorAsCompletionException(CompletableFutureUtils.java:60)

Any idea how to address this issue and what it means?

sirknightj commented 11 months ago

SdkAsyncHttpClient comes from aws-sdk-for-java, please create the issue in that repository instead.

https://github.com/aws/aws-sdk-java-v2