Skip to content

Conversation

@bentsku
Copy link
Contributor

@bentsku bentsku commented Oct 10, 2025

Motivation

Following up on errors report we have where some SDK are directly using the aws-global region to sign the request, leading to exception as our internal stores are validating the regions used.

localstack.aws.api.core.CommonServiceException: exception while calling s3.CreateBucket: 'aws-global' is not a valid AWS region name for s3

This is because some SDK/IaC tools are falling back to the aws-global region for S3 when no region is configured. This is a pseudo-region used only for endpoint resolving by SDK, like in Botocore.
But those SDK will have a mapping to use a certain region for the credentials, meaning they need to use a different region than the pseudo-region for signing the request. The region is us-east-1 is all cases I could find.

But it seems a bug in the SDK themselves might be there, as if you manually override the endpoint by setting AWS_ENDPOINT_URL or something like that, it skips the properly mapping between endpoint/credentials to sign the request and signs the request with aws-global which also fails again AWS.

This PR raises a proper exception in S3, as it's the most touched service, so that at least the proper exception in parity with AWS is returned and we don't return 500 exception when the problem is client side.

The exception can happen globally in any service, but the exception type/object per service and per protocol, so we can scope it down to S3 only for now and generalize if we encounter the issue on other services later. This could also be a specific service request handler for all S3 operations, I'm choosing to scope it down on purpose for now to see if it solves most issues.

Note: failures unrelated, due to update in DynamoDB

Changes

  • add an AWS validated test validating than signing a request with aws-global is not working
  • return the proper exception in s3.CreateBucket and HeadBucket, even if this exception can happen generally globally in LocalStack. We could add better handling of invalid region all together, but this is scoped down to S3 to help users debug their issues and avoid IaC provider breaking on 500 status code.

@bentsku bentsku added this to the 4.10 milestone Oct 10, 2025
@bentsku bentsku self-assigned this Oct 10, 2025
@bentsku bentsku added aws:s3 Amazon Simple Storage Service semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Oct 10, 2025
@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Test Results - Preflight, Unit

22 337 tests  ±0   20 587 ✅ ±0   15m 37s ⏱️ -1s
     1 suites ±0    1 750 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 27fa8d4. ± Comparison against base commit 8f5b405.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

S3 Image Test Results (AMD64 / ARM64)

    2 files  ±0    2 suites  ±0   8m 4s ⏱️ -12s
  533 tests +1  481 ✅ +1   52 💤 ±0  0 ❌ ±0 
1 066 runs  +2  962 ✅ +2  104 💤 ±0  0 ❌ ±0 

Results for commit 27fa8d4. ± Comparison against base commit 8f5b405.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 20s ⏱️ +3s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit 27fa8d4. ± Comparison against base commit 8f5b405.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   2h 39m 33s ⏱️
5 191 tests 4 694 ✅ 497 💤 0 ❌
5 197 runs  4 694 ✅ 503 💤 0 ❌

Results for commit 27fa8d4.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   2h 2m 26s ⏱️ + 1m 58s
4 817 tests +1  4 480 ✅ +1  337 💤 ±0  0 ❌ ±0 
4 819 runs  +1  4 480 ✅ +1  339 💤 ±0  0 ❌ ±0 

Results for commit 27fa8d4. ± Comparison against base commit 8f5b405.

♻️ This comment has been updated with latest results.

@bentsku bentsku marked this pull request as ready for review October 13, 2025 18:45
@bentsku bentsku requested review from k-a-il and thrau as code owners October 13, 2025 18:45
Copy link
Contributor

@k-a-il k-a-il left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@bentsku bentsku merged commit 48d30e0 into main Oct 14, 2025
46 checks passed
@bentsku bentsku deleted the fix-aws-global branch October 14, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:s3 Amazon Simple Storage Service docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants