aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

PUT requests do not support setReadLimit option

Open facuqubika opened this issue 1 year ago • 1 comments

Describe the bug

Reopening #3559 I still don't see any solution to how we can set a read limit when uploading an object with transfer manager using UploadRequest

Expected Behavior

Expose set read limit or an equivalent to set this variable

Current Behavior

"read time out" errors.

Reproduction Steps

Code:

UploadRequest request = UploadRequest.builder().putObjectRequest(
            PutObjectRequest.builder().bucket(bucket).key(key).cacheControl(S3_CACHE_CONTROL_HEADER)
                    .contentMD5(getMd5ObjectContent(key)).metadata(getObjectMetadata(key)).build())
            .build();

//    request.getRequestClientOptions().setReadLimit((int) (object.getObjectMetadata().getContentLength() + 1));
//    Looks like we can't set the read limit https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/best-practices.html
    Upload upload = transferManager.upload(request);

Possible Solution

Expose setReadLimit to UploadRequest

Additional Information/Context

No response

AWS Java SDK version used

2.25.47

JDK version used

8

Operating System and version

Mac

facuqubika avatar May 09 '24 20:05 facuqubika

This is something even recommend it at the end of this documentation

facuqubika avatar May 09 '24 20:05 facuqubika

Hi @facuqubika,

Thank you for reporting the issue. Can you please check if this PR https://github.com/aws/aws-sdk-java-v2/pull/4643 addresses your requirement? Per this change, it allows users to configure max read limit in V2 on Async clients. And with the Sync clients, this could be achieved via RequestBody, (RequestBody#fromContentProvider).

Regards, Chaitanya

bhoradc avatar Jun 05 '24 13:06 bhoradc

It looks like this issue has not been active for more than five days. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please add a comment to prevent automatic closure, or if the issue is already closed please feel free to reopen it.

github-actions[bot] avatar Jun 15 '24 15:06 github-actions[bot]