Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3: get_bucket_location doesn't return expected results #116

Closed
phyber opened this issue Jun 16, 2021 · 6 comments
Closed

s3: get_bucket_location doesn't return expected results #116

phyber opened this issue Jun 16, 2021 · 6 comments
Assignees
Labels
bug This issue is a bug.

Comments

@phyber
Copy link

phyber commented Jun 16, 2021

Bug Report

Version

├── aws-sdk-s3 v0.0.8-alpha (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   ├── aws-endpoint v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   └── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── aws-http v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── aws-hyper v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── aws-endpoint v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── aws-http v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── aws-sig-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   │   ├── aws-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   │   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── protocol-test-helpers v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   ├── smithy-client v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   │   ├── protocol-test-helpers v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   │   ├── smithy-http-tower v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)
│   │   │   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── smithy-http-tower v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   │   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── aws-sig-auth v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── aws-types v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── smithy-http v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   ├── smithy-types v0.0.1 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939) (*)
│   └── smithy-xml v0.1.0 (https://github.com/awslabs/aws-sdk-rust?tag=v0.0.8-alpha#2d876939)

Platform

FreeBSD and Linux

AWS Services

S3

Description

When using get_bucket_location the returned location constrained always seems to be None, even for buckets outside of us-east-1.

The following code should demonstrate it. I was running this in eu-west-1 with buckets also residing in eu-west-1

// Excuse my unwraps, it's just demo code.
use aws_sdk_s3::Client;

#[tokio::main]
async fn main() {
    let client = Client::from_env();
    let resp = client.list_buckets()
        .send()
        .await
        .unwrap();

    // Get a list of buckets
    let bucket_names = if let Some(buckets) = resp.buckets {
        buckets
            .iter()
            .filter_map(|b| b.name.to_owned())
            .collect()
    }
    else {
        Vec::new()
    };

    // Try to get their locations
    for bucket in bucket_names {
        let resp = client.get_bucket_location()
            .bucket(&bucket)
            .send()
            .await
            .unwrap();

        // All of the location constraints are None
        println!(
            "Bucket {} has location_constraint: {:?}",
            &bucket,
            resp.location_constraint,
        );
    }
}
@rcoh rcoh added the bug This issue is a bug. label Jun 16, 2021
@jdisanti
Copy link
Contributor

Thanks for submitting this and providing the example code!

I have reproduced the issue locally and will work on a fix.

@jdisanti jdisanti self-assigned this Jun 16, 2021
@phyber
Copy link
Author

phyber commented Jun 16, 2021

Excellent, thanks. I was hoping I wasn't just holding it incorrectly 😅

@rcoh
Copy link
Contributor

rcoh commented Jun 17, 2021

For anyone else who might be reading this, I just want to say that even if you were holding it incorrectly, in our eyes, that is still our responsibility to fix. We are trying to build an SDK that isn't just correct, but obvious / hard to misuse. So please file issues for problems that occurred due to misuse or confusion, we want to hear them!

@jdisanti
Copy link
Contributor

The fix for this has landed in smithy-rs and will go out with the next release.

@phyber
Copy link
Author

phyber commented Jun 18, 2021

Excellent, thank you very much.

@jdisanti
Copy link
Contributor

This is fixed in v0.0.9-alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants