Skip to content

fix(core): resolve Bedrock region templates - #41786

Closed
kitlangton wants to merge 1 commit into
v2from
bedrock-region-template
Closed

fix(core): resolve Bedrock region templates#41786
kitlangton wants to merge 1 commit into
v2from
bedrock-region-template

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Resolve Bedrock Mantle catalog endpoints containing ${AWS_REGION} from the provider's configured settings.region, even when AWS_REGION is absent from the process environment.

Closes #40075

Before / After

Before: A Bedrock config with settings.region: "us-west-2" and the catalog URL https://bedrock-mantle.${AWS_REGION}.api.aws/openai/v1 failed during model resolution when AWS_REGION was unset. The generic unresolved-variable guard raised UnresolvedProviderVariablesError before the merged native Mantle route could construct or use its regional endpoint.

After: The known Bedrock Mantle AWS_REGION placeholder resolves from configured settings.region first. The native Responses/Chat provider receives https://bedrock-mantle.us-west-2.api.aws/openai/v1, with its endpoint and signing region aligned.

How

  • packages/core/src/model-resolver.ts recognizes only the Bedrock Mantle package and only the AWS_REGION placeholder, preferring configured region before the existing environment substitution pass.
  • packages/core/test/model-resolver.test.ts covers the integrated catalog-to-native-provider path with configured region, no AWS_REGION, and the literal catalog template.
  • The regression failed before the fix with AWS_REGION is required to resolve the provider endpoint.

Scope

Testing

  • cd packages/core && bun run test test/model-resolver.test.ts test/aisdk-native.test.ts (42 pass)
  • cd packages/core && bun typecheck
  • cd packages/ai && bun typecheck
  • Push hook: bun turbo typecheck --concurrency=3 (33 tasks pass)
  • cd packages/ai && bun run test test/provider/bedrock-mantle.test.ts test/provider/bedrock-converse.test.ts test/provider-package.test.ts (60 pass, 1 pre-existing failure in the unchanged supports bearer authentication and custom base URLs test, which receives an empty recorded response)
  • cd packages/core && bunx prettier --check src/model-resolver.ts test/model-resolver.test.ts

@kitlangton

Copy link
Copy Markdown
Contributor Author

This was generated by AI during triage.

Closing in favor of #41816. The replacement keeps Bedrock-specific endpoint normalization in the existing AI SDK-to-native adapter, then performs generic expansion and validation before provider construction, rather than adding Bedrock knowledge to the generic model resolver.

@kitlangton kitlangton closed this Aug 11, 2026
@kitlangton
kitlangton deleted the bedrock-region-template branch August 11, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant