The AddMinio method does not add the IMinioClient to DI correctly
Maxaytt opened this issue · 3 comments
The server does not respond to any actions from the client.
I will describe my actions step by step:
I add minio server to docker compose:
next step i added simple controller: for testing
i writed docker compose up. here are the logs:
next i send POST and GET requests to api:
the response should have been a list from one bucket, but nothing came
UPDATE:
I experimented a little more and realized that DI did not work. Instead of AddMinio, I tried to create a client object manually and everything worked
+1 I encounter this issue.
Current workaround would be to just new up MinioClient when needed and forget about DI
The root cause is that the factory is creating minio with SSL enabled by default.
Using DI will create the minio client using the factory (https://github.com/minio/minio-dotnet/blob/master/Minio/ServiceCollectionExtensions.cs#L47).
This will create the MinioClient
with SSL as defaulted (https://github.com/minio/minio-dotnet/blob/master/Minio/MinioClientFactory.cs#L40).
@Maxaytt If you change your DI registration to the following
builder.Services.AddMinio(configureClient => configureClient
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)
.WithSSL(false));
Then it should work.
Running into the exact same issue with an identical setup, .NET 8 & DI, with or without WithSSL(false)
, with or without .Build()
, I simply cannot get the minio client to do anything, even more frustrating is that it fails completely silently...
I'm currently trying to access the client using the following:
builder.Services.AddMinio(configureClient => configureClient
.WithEndpoint("localhost", 9000)
.WithCredentials(
"realuser",
"veryrealpassword")
.WithSSL(false)
.Build());
Injection fails with both a factory and the standalone client.