I have faced issue while trying to use AWS S3 High-Level API client. The code I am using is pretty much the same as described in AWS example docs - https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/dotnetv3/S3/TrackMPUUsingHighLevelAPIExample/TrackMPUUsingHighLevelAPI.cs#L48
The only thing that is different is client creation as I am setting that manually for testing purposes:
var configuration = new AmazonS3Config
{
ForcePathStyle = true,
ServiceURL = "URL",
};
var credentials = new BasicAWSCredentials("ACCESS_KEY", "SECRET");
IAmazonS3 client = new AmazonS3Client(credentials, configuration);
However, when inserting file I am getting following exception:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
Amazon.S3.AmazonS3Exception: Transfering payloads in multiple chunks using aws-chunked is not supported.
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
at Amazon.Runtime.Internal.HttpHandler`1.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RedirectHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ResponseHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
I am not explicitly setting aws-chunked
anywhere, so I am confused what is the exact issue I am facing.
SDK: AWSSDK.S3 3.7.101.59
Target framework: net6.0
I have tried uploading file using PutObjectRequest
in following way and everything works for me:
fs.Seek(0, SeekOrigin.Begin);
var uploadRequest = new PutObjectRequest
{
InputStream = fs,
Key = outputFileName,
BucketName = bucketName,
UseChunkEncoding = false,
};
await _client.PutObjectAsync(uploadRequest);
CodePudding user response:
I forgot to mention that I am using storage offering from other vendor (not AWS), which supports AWS S3 APIs. Unfortunately, for now it does not support chunked uploads indeed.
GitHub issue - https://github.com/aws/aws-sdk-net/issues/2526#issuecomment-1403700805