Home > OS >  Calling getRegionName() on a awsS3Client backed by minio throws IllegalStateException
Calling getRegionName() on a awsS3Client backed by minio throws IllegalStateException

Time:09-19

Calling getRegionName() on a awsS3Client backed by minio throws IllegalStateException.

The Minio configuration does include a region name. So, it is wierd that getRegionName() fails. That too, it throws IllegalStateException.

"java.lang.IllegalStateException: No valid region has been specified. Unable to return region name"

What's going wrong?

CodePudding user response:

It doesn't matter whether a region is configured in minio configuration.

The problem is because the awsS3Client.getRegionName() checks to make sure that the host name conforms to a AWS domain name regex. If the host name doesn't conform to that pattern, it throws an IllegalStateException.

So, if there is a s3Client.getRegionName() call which you want to work even in Local / Development environments, replace it with just getting the region from your config like appS3Config.getRegion()

  • Related