aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 551 forks source link

com.amazonaws.AmazonClientException: Unable to execute HTTP request: Stream closed #3438

Closed miketextnow closed 10 months ago

miketextnow commented 11 months ago

Describe the bug When calling AmazonCognitoIdentityClient(AnonymousAWSCredentials()).getCredentialsForIdentity(request) we get an AmazonClientException thrown after updating project to jdk17 and Android Gradle Plugin 8.1.1 (previously using jdk11 and AGP version 7.1.0)

To Reproduce A code sample or steps:

Make following request on Android project using jdk 17 and Android Gradle Plugin 8.1.1

        AmazonCognitoIdentityClient(AnonymousAWSCredentials())
                            .getCredentialsForIdentity(request)

Which AWS service(s) are affected? aws-android-sdk-core

Expected behavior Files able to be uploaded to s3

Screenshots If applicable, add screenshots to help explain your problem.

Environment Information (please complete the following information):

Additional context Add any other context about the problem here.

ankpshah commented 11 months ago

Hello @miketextnow, I was not able to replicate the issue and it works as expected with JDK17 and AGP 8.1.1. Could you share more specific details about your setup? I am assuming you are using Unauthenticated Guest Access for the identity pool as you are using AnonymousAWSCredentials(). is that correct? If so have you activated Guest access as explained here

Also make sure you are setting region for the cognito identity client correctly: identityClient.setRegion(Region.getRegion(Regions.YOUR_REGION));

I suspect unstable network connection could be a potential issue here. Furthermore, if above suggestions doesn't help, placing breakpoint in AmazonHttpClient.java L448 and inspecting the Exception can probably give more insights.

miketextnow commented 10 months ago

Thanks for your response! We actually were able to pin point the external library that was injecting code and preventing us from making this request with the sdk. So will close this out.