简体   繁体   中英

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

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?

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM