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

LocationRestraint always empty on GetBucketLocation call #908

Closed
3 tasks done
jcarter3 opened this issue Nov 17, 2020 · 4 comments · Fixed by #1027
Closed
3 tasks done

LocationRestraint always empty on GetBucketLocation call #908

jcarter3 opened this issue Nov 17, 2020 · 4 comments · Fixed by #1027
Labels
bug This issue is a bug.

Comments

@jcarter3
Copy link

jcarter3 commented Nov 17, 2020

Describe the bug
GetBucketLocation returns empty LocationConstraint

Version of AWS SDK for Go?
Example: v0.29.0

Version of Go (go version)?
go version go1.15.5 linux/amd64

To Reproduce (observed behavior)

cfg, err := config.LoadDefaultConfig()
// check err
svc := s3.NewFromConfig(cfg)
bucketLocation, err := svc.GetBucketLocation(context.Background(), &s3.GetBucketLocationInput{Bucket: aws.String("somebucket")})
// check err
fmt.Printf("bucket location: %v\n", bucketLocation.LocationConstraint)
// prints empty location for all buckets in all regions, (even those outside us-east-1)

Expected behavior
For the region that the bucket exists in to be returned (only nil/empty for buckets in us-east-1, per the documentation).

Additional context
I've validated that the proper region is returned via the aws cli

@jcarter3 jcarter3 added the bug This issue is a bug. label Nov 17, 2020
@LumpKim
Copy link

LumpKim commented Dec 7, 2020

Is any solution for this? I had same issue about s3.client.GetBucketLocationOutput.LocationCostraint is empty.

@jasdel jasdel added this to the v1.0 Release Candidate milestone Dec 17, 2020
@jasdel
Copy link
Contributor

jasdel commented Dec 17, 2020

Thanks for reporting this issue @jcarter3 and @LumpKim we're investigating what the cause of this issue is.

@Chandrian
Copy link

I'm having the same issue, I tried with an assume role using the assume role workaround and getting the same empty result.
This was working in older v2 version. I'm using RC now

ctx := context.TODO()
cfg, err = config.LoadDefaultConfig(ctx,
//config.WithClientLogMode(aws.LogSigning|aws.LogRequestWithBody|aws.LogResponseWithBody),
// This can be remove when the following bug has been fixed and dependencies updated to latest
// #914
//config.WithClientLogMode(aws.LogSigning|aws.LogRequestWithBody|aws.LogResponseWithBody),
config.WithAPIOptions([]func(stack *middleware.Stack) error{
func(stack *middleware.Stack) error {
return stack.Initialize.Add(clearContextContentSha256{}, middleware.Before)
},
}),
)
if err != nil {
log.Fatal("failed to load config, %w", err)
}
cfg.Credentials = aws.NewCredentialsCache(stscreds.NewAssumeRoleProvider(
sts.NewFromConfig(cfg),
"arn:aws:iam::123456789012:role/RO"))

	s3Client := s3.NewFromConfig(cfg)

getBucketLocationResponse, err := s3Client.GetBucketLocation(context.Background(),
&s3.GetBucketLocationInput{Bucket: bucket.Name})
if err != nil {
log.Printf("failed to access the bucket: %s. Error message: %v", *bucket.Name, err.Error())
continue
}

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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

Successfully merging a pull request may close this issue.

4 participants