Some upstream dependencies were updated and its a little bit of a pain to revert them. When going from:
PackageReference Include="AWSSDK.S3" Version="3.7.204"
To:
PackageReference Include="AWSSDK.S3" Version="3.7.305.8"
I can no longer upload a file, I get the following error:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
The code(example) being executed is as follows:
AmazonS3Client client = new AmazonS3Client(
"access",
"secret",
new AmazonS3Config
{
AuthenticationRegion = RegionEndpoint.USEast1.SystemName,
ServiceURL = "https://s3.wasabisys.com",
ForcePathStyle = true, // Needed to work with Minio
RetryMode = RequestRetryMode.Standard,
MaxErrorRetry = 3
});
string file = @"C:\Users\whaggerty\Documents\juryDuty.pdf";
string bucket = "default-2023-10";
string key = "juryDuty.pdf";
TransferUtilityUploadRequest uploadRequest = new()
{
BucketName = bucket,
Key = key,
PartSize = 6291456, // 6 MB. (Same as FileService)
FilePath = file,
};
using TransferUtility archiveUtility = new(client);
await archiveUtility.UploadAsync(uploadRequest);
Does anyone have any insight into what's causing this, and or how to fix it?
All I needed to do was set the SignatureVersion to "2". I was messing around with that value last week but I thought I was supposed to use the SignatureVersion enum so I was doing it wrong. There are only two accepted values right now from what I can tell. "1" for SHA1 and "2" for SHA256.
AmazonS3Client client = new AmazonS3Client(
"access",
"secret",
new AmazonS3Config
{
AuthenticationRegion = RegionEndpoint.USEast1.SystemName,
ServiceURL = "https://s3.wasabisys.com",
ForcePathStyle = true, // Needed to work with Minio
RetryMode = RequestRetryMode.Standard,
MaxErrorRetry = 3,
SignatureVersion = "2"
});