Skip to content

Issues with upgraded AWSSDK.S3 dependency in release v1.1.0 and upwards #7

Closed
@petervannes

Description

@petervannes

In version 1.1.1 the PackageReference version for AWSSDK. S3 has been bumped to 3.7.412.5.
After bumping my tusdotnet.Storage.S3 version from v1.0.2 to v1.1.1 uploads from a tus-is-client to a tusdotnet server failed with the exception;

Net Connection id "...", Request id"...:0000000D": An unhandled exception was thrown by the application.
Amazon. S3 .AmazonSException: The Content-SHA256 you specified did not match what we received
--→> Amazon. Runtime. Internal. HttpErrorResponseException: Exception of type
' Amazon. Runtime. Internal. HttpErrorResponseException' was thrown.

Due to the NuGet dependency resolution it is not possible to forcibly downgrade the AWSSDK.S3 version by adding a
explicit version in the csproj.

The exception is caused by the new default integrity protections in de AWSSDK.S3 version 3.7.412.0
(aws/aws-sdk-net#3610) and our not Amazon AWS S3 storage.
So when using MinIO or Dell ECS this exception may occur.

For now it can be resolved by adding the configuration option "RequestChecksumCalculation" with value
"RequestChecksumCalculation. WHEN _REQUIRED" to the S3 configuration.

public static class Tusstore
{
    Public static void AddusStore(this IServicecollection services, IConfiguration configuration, ILogger< TusS3Store> logger)
    {
        var objectStorageSettings = new ObjectStorageSettings();
        configuration.GetSection("ObjectStorage").Bind(objectStorageSettings);
        var tusS3StoreConfig = new TusS3StoreConfiguration
        {
            BucketName = objectStorageSettings. BucketName!,
        }
        var awsCredentials = new BasicAWSCredentials(objectStorageSettings.AccessKey, objectStorageSettings.Secret);
        var objectStoreConfig = new AmazonS3Config
        {
             ServiceURL = objectStorageSettings. Endpoint,
             ForcePathStyle = true,
             RequestChecksumCalculation = RequestChecksumCalculation.WHEN_REQUIRED
        }
        var tusObjectStore = new TusS3Store(logger, tusS3StoreConfig, awsCredentials, objectStoreConfig);
        services.AddSingleton(tusObjectStore);
    }
}

See also; https://docs.aws.amazon.com/sdkref/latest/guide/feature-dataintegrity.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions