Skip to content

Bedrock: 2.0.4 requires AWS_REGION despite a configured provider region #49391

Description

@acorpstein

Description

After upgrading from 2.0.3 to 2.0.4, Bedrock model initialization started failing with an error about AWS_REGION being required. The matching error in the source is:

Cannot initialize amazon-bedrock/<model>: AWS_REGION is required to resolve the provider endpoint

Expected: Bedrock Mantle endpoint templates should use the configured/default provider region without requiring a separate AWS_REGION environment variable.

The likely regression is #48943, commit 2226afaea5. In 2.0.3, AISDKNative.map ran during model resolution, after provider/model settings were merged. In 2.0.4, AISDKNative.rewrite runs separately on provider/model writes. A provider-level region and model-level baseURL containing ${AWS_REGION} are therefore normalized separately, then merged too late for the placeholder substitution. ModelResolver.prepareProviderURL subsequently checks only process.env and rejects the unresolved URL.

cc @rekram1-node — could you take a look at this possible regression from #48943?

OpenCode version

Reported working: 2.0.3. Reported broken: 2.0.4. Currently running 2.0.3 again. The relevant implementation is also unchanged in the 2.0.5 source inspected.

The merged settings contain a region, but endpoint validation can still fail before AWS credential resolution. Existing region tests provide region and baseURL together in one model settings object, so they do not cover this split provider/model case.

Plugins

No response

OpenCode version

2.0.4-2.0.5

Steps to reproduce

  1. Configure Bedrock with a working AWS profile and a provider-level region, such as us-west-2.
  2. Leave AWS_REGION unset in the server process environment.
  3. Select a Mantle model whose catalog entry supplies a model-level endpoint such as https://bedrock-mantle.${AWS_REGION}.api.aws/openai/v1.
  4. Submit a prompt on 2.0.4.

Screenshot and/or share link

No response

Operating System

Linux x86_64, kernel 6.12

Terminal

tmux (TERM=xterm-256color, COLORTERM=truecolor), zsh. Diagnostics collected after returning to 2.0.3.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions