-
Notifications
You must be signed in to change notification settings - Fork 864
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
Uploading stream to S3 invoke error "The request body terminated unexpectedly" #3616
Comments
Are you using S3 or a 3rd-party implementation? We made a change last week so that the SDK automatically calculates checksums for all If this is happening with S3, we'd need more details (what region, what does your input stream look like, etc...) |
Can confirm this error with multiple different 3rd-party implementations like hetzner and openstack. |
Got it, thanks for confirming it's happening for 3rd-party implementations. As mentioned in the announcement I linked earlier, this is a change we made intentionally and there's a config option you can set to disable the checksum calculation for var s3Config = new AmazonS3Config
{
ServiceURL = "your-custom-service-url",
RequestChecksumCalculation = RequestChecksumCalculation.WHEN_REQUIRED,
};
var s3 = new AmazonS3Client(s3Config);
await s3.PutObjectAsync(...); This should unblock you, although obviously the ideal solution would be for the 3rd-party implementations to support this new behavior as it's in place for all AWS SDKs - not only .NET (this documentation page from S3 explains how the data integrity works: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) |
@dscpinheiro thank you for your fast response. |
Sorry for the late response. I guess you already found the anaswer though ;) |
Comments on closed issues are hard for our team to see. |
Describe the bug
Simple upload of stream as follow:
var request = new PutObjectRequest { BucketName = _bucketName, Key = path, InputStream = stream };
It all worked in AWSSDK.S3 version 3.7.411.7 but since version 3.7.412 I keep getting exception with error code 'IncompleteBody':
Amazon.S3.AmazonS3Exception: The request body terminated unexpectedly
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(HttpResponseMessage responseMessage)
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
at Amazon.Runtime.Internal.HttpHandler1.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) --- End of inner exception stack trace --- at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream) at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionAsync(IExecutionContext executionContext, HttpErrorResponseException exception) at Amazon.Runtime.Internal.ExceptionHandler1.HandleAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.ProcessExceptionAsync(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.Signer.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.S3.Internal.S3Express.S3ExpressPreSigner.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
at DigitalLegacy.Infrastructure.S3.S3FileStorage.UploadFile(String absolutePath, Stream fileStream)
Regression Issue
Expected Behavior
The stream should have been uploaded to S3
Current Behavior
I get exceptions indicating the stream was closed before finished uploading
Reproduction Steps
Just try to upload a stream using PutObjectRequest
var request = new PutObjectRequest { BucketName = _bucketName, Key = path, InputStream = stream };
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.S3 3.7.412
Targeted .NET Platform
.NET 9
Operating System and version
Windows
The text was updated successfully, but these errors were encountered: