Skip to content

fix(pull): pin AWS region for STS so devbox global push works without an ambient region - #2938

Open
mikeland73 wants to merge 2 commits into
mainfrom
claude/focused-goldberg-wz6a8n
Open

fix(pull): pin AWS region for STS so devbox global push works without an ambient region#2938
mikeland73 wants to merge 2 commits into
mainfrom
claude/focused-goldberg-wz6a8n

Conversation

@mikeland73

Copy link
Copy Markdown
Collaborator

Summary

Fixes #2591.

devbox global push fails for users who don't have an AWS region configured in their environment (e.g. a fresh Jetify signup with no ~/.aws/config and no AWS_REGION/AWS_DEFAULT_REGION):

Error: operation error STS: AssumeRoleWithWebIdentity, failed to resolve service
endpoint, endpoint rule error, Invalid Configuration: Missing Region

Root cause: In internal/pullbox/s3/config.go, assumeRole built the STS client from config.LoadDefaultConfig(ctx) with no region. AWS SDK v2 cannot resolve the STS endpoint without a region, so when the environment supplies none, the call fails before the role can be assumed.

The region constant (us-east-2, where the devbox.sh bucket lives) already existed, but it was only applied to the downstream S3 config — and only via a post-hoc config.Region = region mutation, because the local variable was named config and shadowed the imported config package (which is why config.WithRegion(...) couldn't be used there).

Fix:

  • Pin the region on both configs (STS and S3) via config.WithRegion(region).
  • Rename the shadowing local variable to cfg so the config package is usable.
  • Stop ignoring the error from the first LoadDefaultConfig, and only set the region on success (the old code assigned config.Region before checking the error).

The change is minimal and isolated to the credential-assumption helper; behavior for users who do have a region configured is unchanged (the region was already pinned for the S3 config).

How was it tested?

  • go build ./internal/pullbox/..., go vet ./internal/pullbox/s3/, and gofmt all clean.
  • Added internal/pullbox/s3/config_test.go (TestConfigPinsRegion) which reproduces the reporter's environment — all AWS region sources cleared — and verifies that a plain LoadDefaultConfig yields an empty region (the failing condition) while the pinned config.WithRegion(region) yields the expected region. Passes: go test ./internal/pullbox/s3/.
  • End-to-end verification of devbox global push itself requires a Jetify cloud account and network, so it isn't exercised in CI here; the fix follows directly from the AWS SDK v2 requirement that STS/S3 clients have a resolvable region.

cc @svandragt (issue reporter)

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.


🤖 Generated with Claude Code

https://claude.ai/code/session_01NZuVavP5v2abUek98MDBCQ


Generated by Claude Code

claude added 2 commits July 30, 2026 14:16
…ut an ambient region (#2591)

The STS client used to assume the JetpackS3Federated role was built from
config.LoadDefaultConfig(ctx) with no region. AWS SDK v2 cannot resolve the
STS endpoint without a region, so users who have no AWS region configured in
their environment (a fresh Jetify signup, no ~/.aws/config, no AWS_REGION)
hit:

    Error: operation error STS: AssumeRoleWithWebIdentity, failed to resolve
    service endpoint, endpoint rule error, Invalid Configuration: Missing Region

The `region` constant already existed and was applied to the downstream S3
config, but only via a post-hoc `config.Region = region` mutation because the
local variable shadowed the imported `config` package. Pin the region on both
configs via config.WithRegion(region), fix the shadowing (cfg), and stop
ignoring the first LoadDefaultConfig error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZuVavP5v2abUek98MDBCQ
- Use t.Context() instead of context.Background() in the new test.
- Rename the too-short assumeRole parameter `c` to `cred`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZuVavP5v2abUek98MDBCQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Invalid Configuration: Missing Region when pushing global config

2 participants