Skip to content

fix(ai): resolve Bedrock regions without implicit defaults - #45398

Closed
rekram1-node wants to merge 1 commit into
v2from
bedrock-region
Closed

rekram1-node wants to merge 1 commit into
v2from
bedrock-region

Conversation

@rekram1-node

Copy link
Copy Markdown
Collaborator

Summary

  • resolve native Bedrock Converse and Mantle regions from explicit region, existing credentials.region, then AWS_REGION; trim values and remove the silent us-east-1 fallback
  • fail model initialization with an actionable typed AIError (InvalidRequest, parameter region) when region is missing or blank
  • defer route construction until model selection so importing providers or creating an unconfigured facade remains safe
  • allow region omission for custom baseURL plus bearer apiKey; SigV4 and generated AWS endpoints still require region
  • use the resolved region for both endpoint construction and signing without mutating caller credentials
  • resolve region before Core maps static credentials and substitutes ${AWS_REGION} in catalog URLs, including legacy endpoint aliases and directly selected native packages
  • preserve native initialization AIErrors through ModelResolver and generation rather than replacing them with misleading unsupported-package errors

Scope

This is the focused native region/configuration fix. AWS profile/config-file discovery, credential chains and refresh, bearer-token environment resolution, and changes to the legacy AI SDK hooks are not included. No new public error schema or Server/Protocol API changes. Existing callers that relied on the native default region must now pass region or set AWS_REGION.

Also corrects one stale package-alias assertion left by #45394: Mantle defaults to Responses, not Chat.

Verification

  • 65 targeted AI tests passed across region, Converse, Mantle, and native-provider suites
  • provider package import/alias test passed with AWS_REGION unset
  • 70 Core tests passed across native mapping, model resolution, generation, and session errors
  • bun typecheck passed in packages/ai and packages/core
  • Prettier and git diff --check passed
  • independent review found and then verified the direct-native URL/signing-region fix; no remaining findings

Full-Suite Baseline

Full AI suite: 754 passed, 25 skipped, 14 failed. Clean v2 at 767115cd69: 748 passed, 25 skipped, 15 failed. No new failures; the Mantle alias assertion is fixed. The other failures are existing WebSocket executor expectations, Anthropic fixtures/package expectations, and OpenRouter fixtures/reasoning expectations. The full Core suite was not run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant