UpdateMetadata during CopyObject issue: "The request signature we calculated does not match the signature you provided. Check your key and signing method."
See original GitHub issueHello,
basically the minio-dotnet client works great, but shouldn’t it be supported to update the metadata of an object by using the CopyObjectAsync
? Doing so results in an MinioException
:
Minio.Exceptions.MinioException:
MinIO API responded with message=The request signature we calculated does not match the signature you provided. Check your key and signing method.\r\n at Minio.MinioClient.ParseError(IRestResponse response)
Please see also the following test:
private async static Task UpdateMetadata_Test(MinioClient minio)
{
DateTime startTime = DateTime.Now;
string bucketName = GetRandomName(15);
string objectName = GetRandomName(10);
string destBucketName = bucketName;
string destObjectName =objectName;
Dictionary<string,string> args = new Dictionary<string,string>
{
{"bucketName", bucketName},
{"objectName",objectName},
{"destBucketName", destBucketName},
{"destObjectName", destObjectName},
{"data","1KB"},
{"size","1KB"},
{"copyconditions","x-amz-metadata-directive:REPLACE"},
};
try
{
await Setup_Test(minio, bucketName);
using (MemoryStream filestream = rsg.GenerateStreamFromSeed(1 * KB))
{
await minio.PutObjectAsync(bucketName,
objectName,
filestream, filestream.Length, metaData:new Dictionary<string,string>{{"X-Amz-Meta-Orig", "orig-val with spaces"}});
}
ObjectStat stats = await minio.StatObjectAsync(bucketName, objectName);
Assert.IsTrue(stats.metaData["X-Amz-Meta-Orig"] != null) ;
CopyConditions copyCond = new CopyConditions();
copyCond.SetReplaceMetadataDirective();
// set custom metadata
Dictionary<string,string> metadata = new Dictionary<string,string>()
{
{ "Content-Type", "application/css"},
{"X-Amz-Meta-Mynewkey","test test"}
};
await minio.CopyObjectAsync(bucketName, objectName, destBucketName, destObjectName,copyConditions:copyCond,metadata: metadata);
ObjectStat dstats = await minio.StatObjectAsync(destBucketName, destObjectName);
Assert.IsTrue(dstats.metaData["X-Amz-Meta-Mynewkey"] != null);
await minio.RemoveObjectAsync(bucketName, objectName);
await minio.RemoveObjectAsync(destBucketName, destObjectName);
await TearDown(minio, bucketName);
await TearDown(minio, destBucketName);
new MintLogger("CopyObject_Test8",copyObjectSignature,"Tests whether CopyObject with metadata replacement passes",TestStatus.PASS,(DateTime.Now - startTime), args:args).Log();
}
catch (MinioException ex)
{
new MintLogger("CopyObject_Test8",copyObjectSignature,"Tests whether CopyObject with metadata replacement passes",TestStatus.FAIL,(DateTime.Now - startTime),"",ex.Message, ex.ToString(),args).Log();
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to fix 'The request signature we calculated does not ...
It is producing the following error: The request signature we calculated does not match the signature you provided. Check your key and signing...
Read more >Error "The request signature we calculated does not match ...
Amazon S3 Connector | Error "The request signature we calculated does not match the signature you provided. Check your key and signing method"...
Read more >Amazon S3 CopyObject Rest API - Signature Mismatch Error
... <Message> The request signature we calculated does not match the signature you provided. Check your key and signing method. </ Message>.
Read more >How to fix 'The request signature we calculated ... - YouTube
PHP : Amazon S3 - How to fix 'The request signature we calculated does not match the signature ' error? [ Beautify Your...
Read more >ECS Data Access Guide
The request signature calculated does not match the signature provided. Check the Secret. Access Key and signing method. ZeroAmzExpires.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ptr1120, port is being stripped off the host header by underlying httpclient which leads to a mismatch between signature sent by client to that computed by server. There was a bug in dotnet corefx which was fixed last year (https://github.com/restsharp/RestSharp/issues/1085) - will have to dig further to pinpoint whether it is an issue with Restsharp / HttpClient in dotnet/corefx
Please upgrade to the latest release and re-open if seen again.