minio / minio-js

MinIO Client SDK for Javascript
https://docs.min.io/docs/javascript-client-quickstart-guide.html
Apache License 2.0
920 stars 271 forks source link

fix use configured region from constructor for makebucket #1293

Closed prakashsvmx closed 3 months ago

prakashsvmx commented 3 months ago

fix use configured region from constructor for makebucket

Fixes https://github.com/minio/minio-js/issues/1292

const s3Client = new Minio.Client({
  endPoint: 'localhost',
  accessKey: 'minio',
  secretKey: 'minio123',
  useSSL: false,
  port: 22000,
  // region:'us-west-1'
  //partSize: 5 * 1024 * 1024,
})

// Create a bucket name my-bucketname-3.
// await s3Client.makeBucket('my-bucketname-3')

// Create a bucket name my-bucketname.
// await s3Client.makeBucket('my-bucketname-2','us-west-1')

// List all object paths in bucket my-bucketname-2. and observe trace for the correct region in request. 
var objectsStream = s3Client.listObjects('my-bucketname-2', '', true)
objectsStream.on('data', function (obj) {
  console.log(obj)
})
objectsStream.on('error', function (e) {
  console.log(e)
})

to change region in MinIO,

 mc admin config set local22 region name=us-west-1 && mc admin service restart local22

to reset to default region in MinIO

mc admin config set local22 region name= && mc admin service restart local22