-
Notifications
You must be signed in to change notification settings - Fork 861
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:GetBucketLocation throws AuthorizationHeaderMalformed when using cross-account roles #1835
Comments
Further information -- it definitely appears to be a periodic issue, as it isn't happening right now, but was happening Friday afternoon. Same exact code in our application. |
Hi @Dreyerized, Good afternoon. Would it be possible for you to share a sample code to reproduce the issue? Also confirm if this is still an issue. Thanks, |
This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled. |
I am having the same issue. The task is to filter the buckets based on selected region (from user). It works fine for the default region: var client = new AmazonS3Client(accessKey, secretKey, RegionEndpoint.GetBySystemName(selectedRegion))
var buckets = client.ListBuckets().Buckets;
buckets.ForEach(item => {
var location = GetBucketLocation(client, item.BucketName);
...
if (location == selectedRegion)
{
result.Add(item);
}
...
});
private string GetBucketLocation(IAmazonS3 client, string bucketName)
{
GetBucketLocationRequest request = new GetBucketLocationRequest { BucketName = bucketName };
GetBucketLocationResponse response = client.GetBucketLocation(request);
return response.Location;
} Environment |
Seeing exactly same issue as @NJ261 and @david-dreyer mentioned above using code snippet that @NJ261 provided. |
Description
We have an application that assumes a role in other AWS accounts, and performs actions on those accounts such as getting information about buckets in S3.
When calling GetBucketLocationAsync, if the bucket is in a different region than the client, the client will throw an exception:
AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2' status code: 400
Where in the above, 'us-east-1' is the region the client is for, and 'us-west-2' is the region of the bucket. It is unclear as to whether this always happens, or happens periodically. We saw it happen in the past, and then it seemed to have stopped, and then started happening again last week.
This also seems to have been an issue with the Go SDK in the past, as seen here:
aws/aws-sdk-go#380
The same exact workaround, setting ForcePathStyle = true on the client, makes this exception go away. However, I'm not sure if there's any possibly unintended side effects of doing that, and also it doesn't seem like that should be required in the first place.
Reproduction Steps
Environment
We are currently on a slightly outdated version of the SDK, but it doesn't appear that anything has changed that would have fixed this. I very well could be wrong with that statement, though, so please correct me if it has been.
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: