Closed HunteRoi closed 3 months ago
Hello, it seems that the makeBucket method is not using the region defined in the constructor of the MinioClient.
makeBucket
MinioClient
As implied by the types documentation, I shouldn't provide the region (also the whole API makes it obviousy we shouldn't).
So why doesn't it work as expected? I received the following error:
{ "name":"S3Error", "code":"AuthorizationHeaderMalformed", "message":"The authorization header is malformed; the region is wrong; expecting 'eu-west-1'.", "bucketname":"mybucket", "resource":"/mybucket", "region":"eu-west-1", "requestid":"17CE946273A06571", "hostid":"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8", "amzRequestid":"17CE946273A06571", "amzId2":"dd9025bab4ad464b049177c95eb6ebf374d3b3fd1af9251148b658df7ac2e3e8", "amzBucketRegion":"eu-west-1" }
const minioClient = new MinioClient({ endPoint: env.MINIO_ENDPOINT, port: env.MINIO_PORT, useSSL: false, accessKey: env.MINIO_ACCESS_KEY, secretKey: env.MINIO_SECRET_KEY, region: env.MINIO_REGION, }); const bucketExists = await minioClient.bucketExists(env.MINIO_BUCKET); if (!bucketExists) { await minioClient.makeBucket(env.MINIO_BUCKET); // fails } await minioClient.putObject(env.MINIO_BUCKET, id, payload.image);
await minioClient.makeBucket(env.MINIO_BUCKET, env.MINIP_REGION); // works
My team and I checked your code and we saw that there's a difference between what we have in our VSCode typing docs and what is wrote here: https://github.com/minio/minio-js/blob/6b916367ec13283b950d5932825e669a344d11ce/src/internal/client.ts#L849
cc @drakexorn @MRGoose70
Thank you for reporting, we will check and send a fix
@prakashsvmx can you tell me when is the next release planned by the way?
We have few more APIs to be migrated to TS. So no fixed ETA.
Hello, it seems that the
makeBucket
method is not using the region defined in the constructor of theMinioClient
.As implied by the types documentation, I shouldn't provide the region (also the whole API makes it obviousy we shouldn't).
So why doesn't it work as expected? I received the following error:
Context
Code used
Quick fix
How I knew what to do
My team and I checked your code and we saw that there's a difference between what we have in our VSCode typing docs and what is wrote here: https://github.com/minio/minio-js/blob/6b916367ec13283b950d5932825e669a344d11ce/src/internal/client.ts#L849
cc @drakexorn @MRGoose70