question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Hello,

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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
poornascommented, Apr 18, 2019

@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

0reactions
harshavardhanacommented, Mar 14, 2022

Please upgrade to the latest release and re-open if seen again.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found