durch / rust-s3

Rust library for interfacing with S3 API compatible services
MIT License
498 stars 195 forks source link

Error in custom region when create the bucket. #340

Closed jiajun-c closed 1 week ago

jiajun-c commented 1 year ago

Describe the bug When use the custom region, it will report the urlParse(InvalidIpv4Address)

To Reproduce

pub async fn create_bucket(bucket_name: &str) -> Result<CreateBucketResponse, S3Error> {
    let region =  Region::Custom {
        region: "eu-central-1".to_owned(),
        endpoint: "127.0.0.1:9000".to_owned(),
    };
    let assess_key = "admin";
    let secret_key = "admin123";
    let config = BucketConfiguration::default();
    let cred = Credentials::new(Some(assess_key), Some(secret_key), None, None, None)?;
    let create_bucket_respone = Bucket::create(bucket_name, region, cred, config);
    create_bucket_respone.await
}

Expected behavior A bucket should be create in my local minio, but it doesn't. Environment

kyasu1 commented 1 year ago

Hi, I was also stuck on the same issue. It seems that minio uses the path style by default while AWS uses the subdomain style.

https://github.com/durch/rust-s3#path-or-subdomain-style-urls-and-headers

So we need to use create_with_path_style to create and access buckets on the default minio or configure your minio to run as subdomain (virtual-host) style.