Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listObjectsV2 gives S3Exception after version 2.7.0 #1434

Closed
trygveaa opened this issue Sep 19, 2019 · 2 comments
Closed

listObjectsV2 gives S3Exception after version 2.7.0 #1434

trygveaa opened this issue Sep 19, 2019 · 2 comments
Labels
investigating This issue is being investigated and/or work is in progress to resolve the issue.

Comments

@trygveaa
Copy link

When using version 2.7.0 or later, calling listObjectsV2 throws this exception:

software.amazon.awssdk.services.s3.model.S3Exception: null (Service: S3, Status Code: 302, Request ID: null)

listObjects works if I don't provide a prefix, but if I specify one, I get the same error.

With version 2.6.5 it's working fine.

Expected Behavior

listObjectsV2 should list the objects and not throw an exception.

Current Behavior

The exception mentioned above is thrown. When looking at the HTTP requests sent, I see that the old version requests GET /?list-type=2 HTTP/1.1 while the new version requests GET ?list-type=2 HTTP/1.1, which is what triggers the 302 response from the API.

Steps to Reproduce (for bugs)

The issue can be reproduced with this code (which is in Kotlin):

val s3 = S3Client.builder().region(Region.EU_WEST_1).build()
s3.listObjectsV2 { it.bucket(bucketName).build() }

Your Environment

  • AWS Java SDK version used: I tried 2.9.2 and 2.7.0
  • JDK version used: 12, and using Kotlin
  • Operating System and version: Arch Linux. Also tested on macOS and got the same error.
@dagnir dagnir added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Sep 19, 2019
@dagnir
Copy link
Contributor

dagnir commented Sep 19, 2019

@trygveaa Judging from the change in the request line (GET /?list-type=2 vs GET ?list-type=2), this looks related to #1224, where we updated the Apache client to 4.5.9 because of a bug in 4.5.8 that chanted the way paths were normalized.

I was able to reproduce this by taking a direct dependency on 4.5.8 in my test project:

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.8</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.10</version>
        </dependency>

Can you ensure that you don't have an affected version of the httpclient on your classpath?

@trygveaa
Copy link
Author

@dagnir: Ah, I did indeed have httpclient 4.5.8 in my classpath (not sure why though, I thought gradle should pick the highest version on conflicts, and my other dependencies depended on older versions of httpclient, not 4.5.8). After specifying 4.5.10 explicitly, the issue is fixed. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating This issue is being investigated and/or work is in progress to resolve the issue.
Projects
None yet
Development

No branches or pull requests

2 participants