Skip to content

s3 bucket condition filtering error #2148

Closed
@liwande

Description

@liwande

Describe the bug

The listObjects and listObjectsV2 methods of aws-sdk-java-v2 S3 will report an error ,if the built-in attribute prefix or maxKeys attribute is specified (no error will be reported if you do not specify it)
The error content is as follows: Exception in thread "main" software.amazon.awssdk.services.s3.model.S3Exception: null (Service: S3, Status Code: 302, Request ID: null)

Expected Behavior

The s3 bucket condition can specify the prefix or the maximum number of objects returned

Current Behavior

The specified prefix or the maximum number of objects returned is abnormal

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

Steps to Reproduce

AwsCredentialsProvider awsCredentialsProvider = () -> AwsBasicCredentials.create(awsConfig.getAccessKeyId(), awsConfig.getSecretAccessKey());

    Region region = Region.of(awsConfig.getRegion());
    s3Client = S3Client.builder()
            .region(region)
            .credentialsProvider(awsCredentialsProvider)
            .build();

    ListObjectsRequest listObjects = ListObjectsRequest
            .builder()
            .bucket(bucketName)

// .maxKeys(10)
.build();

    ListObjectsResponse response = s3Client.listObjects(listObjects);
    List<S3Object> contents = response.contents()

comment:The listObjects and listObjectsV2 methods of aws-sdk-java-v2 S3 will report an error

Possible Solution

Context

Your Environment

  • AWS Java SDK version used: aws-sdk-java-v2
  • JDK version used: jdk1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.closed-for-stalenessresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions