minio-dotnet: Error uploading large files to MinIO server

Expected Behavior

upload successful

Current Behavior

MinIO API responded with message=The request signature we calculated does not match the signature you provided. Check your key and signing method.

Steps to Reproduce (for bugs)

c# client, verson 3.0.12 latest docker server this is my code:

public async Task UploadFile(string bucketName, Stream fileStream, string fileName, long fileSize, string contentType)
{
            bool found = await minioClient.BucketExistsAsync(bucketName);
            if (!found)
            {
                await minioClient.MakeBucketAsync(bucketName);
            }
            // Upload a file to bucket.
            await minioClient.PutObjectAsync(bucketName, fileName, fileStream, fileSize, contentType);
}

where: bucketName : “patients” stream : the resulting stream from an upload to a asp.net web page fileSize: 19589050 content-type: “application/pdf”

it works fine with smallest PDF files (40KB, 100KB) but if i try to upload biggest files (20 MB for example) i have this exception:

MinIO API responded with message=The request signature we calculated does not match the signature you provided. Check your key and signing method.

STACKTRACE:

in Minio.MinioClient.ParseError(IRestResponse response) in Minio.MinioClient.<>c.<.ctor>b__80_0(IRestResponse response) in Minio.MinioClient.HandleIfErrorResponse(IRestResponse response, IEnumerable`1 handlers, DateTime startTime) in Minio.MinioClient.d__84.MoveNext() — Fine traccia dello stack da posizione precedente dove è stata generata l’eccezione — in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in Minio.MinioClient.d__20.MoveNext() — Fine traccia dello stack da posizione precedente dove è stata generata l’eccezione — in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in Minio.MinioClient.d__15.MoveNext() — Fine traccia dello stack da posizione precedente dove è stata generata l’eccezione — in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.GetResult() in API.Managers.MinIOManager.d__5.MoveNext() in C:\Users\dcalzetta\source\repos\TPO_Web\API\Managers\MinIOManager.cs:riga 43 — Fine traccia dello stack da posizione precedente dove è stata generata l’eccezione — in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.GetResult() in API.Controllers.DocumentController.d__7.MoveNext() in C:\Users\dcalzetta\source\repos\TPO_Web\API\Controllers\DocumentController.cs:riga 288

where i’m wrong?

i’m using a docker MINIO server for develompent scope, minio/minio latest 77a8467ccda1 8 days ago 63.5MB

docker run -d -p 9000:9000 -v /opt/minio/data:/data --restart unless-stopped -e "MINIO_ACCESS_KEY=xxxxxxx" -e "MINIO_SECRET_KEY=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" minio/minio server /data

I also tryed some variants, but the error is the same

  • creating self signed certificates on server a conneting the client WithSSL()
  • using server side encryption and not
  • adding or not metatadata to files
  • changing the content type form “applitcation/pdf” to “octect/stream”

Configuration of my ASP.NET application in my web.config i extended max upload size to 100Mb,

<system.web>
  <compilation debug="true" targetFramework="4.6.2" />
  <httpRuntime targetFramework="4.6.1" maxRequestLength="102428" />
</system.web>

...

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="102428800" />
    </requestFiltering>
  </security>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

I found the problem by myself! The problem is the RestSharp version, i was using the latest 106.6.10 and with this RestSharp installed on my project the upload fails. Then I tryed to downgrading step by step, and with the RestSharp to version 106.4.2 (and lower) the upload works without errors!

Then, i preferr to work with the latest RestSharp 106.6.10, can you fix this problem on the Minio c# client?

here you can find a Sample console application visual studio Project that has the error, https://1drv.ms/u/s!AnF_YQvROGqPgrsrebBvnbZgmLzXTw?e=sM9cQr

Thanks for reporting @danilonet we’ll take a look