Skip to content

[Bug]: Bring-Your-Own-Key Amazon Bedrock providers fail with "AWS region setting is missing" for every model, even with a correctly configured region #5705

Description

Summary

Status: Confirmed, reproduced, root cause isolated to a specific missing code path. Not yet filed upstream.
Affected version: v0.18.54 (also present in v0.18.42–v0.18.52; the relevant code is unchanged across that range — see "Version scope" below).
Affects: Any self-hosted OpenWork EE deployment using the dashboard's "Bring Your Own Keys" → Amazon Bedrock custom LLM provider (Settings → AI Gateway → AI Providers → Legacy Providers, route /dashboard/custom-llm-providers/:id).
Does not affect: The newer "AI Gateway" credential-set feature (a different, parallel code path that validates and forwards region correctly — see below). Org-hosted/managed models that aren't Bedrock-backed are unaffected.

No credentials, tokens, account IDs, or other secret material are included anywhere in this document.

Summary

A self-hosted org connects an Amazon Bedrock provider via Bring Your Own Keys (BYOK), supplying AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, and AWS_BEARER_TOKEN_BEDROCK. The dashboard confirms the credential as "Saved" and the desktop app's own Settings → Environment panel confirms all four variables, under app-assigned namespaced names (e.g. LPR_NCEED_AWS_REGION), are correctly present on-device with the expected values.

Despite this, every chat request against every model attached to that provider fails, regardless of which specific Bedrock model is selected (tested with both a plain, single-region model ID and a cross-region "global." inference-profile model ID — both failed identically), with:

ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
  ...
AWS region setting is missing. Pass it using the 'region' parameter or the
AWS_REGION environment variable.

The inner message is the Vercel AI SDK's generic loadSetting error text, the same template used by other @ai-sdk/* provider packages (confirmed by its exact phrasing pattern, which also appears verbatim in @ai-sdk/google-vertex's own tests). It fires because the underlying Bedrock client is constructed without a region option and finds no AWS_REGION in process.env — because the only region value actually present in the process environment is named LPR_NCEED_AWS_REGION, not AWS_REGION.

Why this isn't a configuration mistake

This was reproduced and isolated step by step, specifically to rule out "someone just left a field blank":

  1. The affected provider's AWS_REGION value was already marked "Saved" (non-empty) in the dashboard before any changes were made.
  2. We explicitly set it to a known-valid value (us-east-1) via Edit Provider → AWS_REGION and saved. The provider record's updatedAt timestamp changed, confirming the write succeeded server-side.
  3. The identical error reproduced immediately afterward, with the same model.
  4. We then added a second, structurally different model to the same provider — a plain single-region Bedrock model ID (no cross-region/"global." prefix) — and tested that instead. Same error, verbatim. This rules out any cross-region-inference-profile-specific parsing issue.
  5. We then inspected the desktop app's own Settings → Environment panel (Save API keys and tokens for local agents, skills, and MCP servers. Secrets stay on this device.), and confirmed all four provider variables are present on-device with correct values, including LPR_NCEED_AWS_REGION showing the exact value we'd just set.

So the region value: exists, is valid, is saved server-side, and is correctly delivered to and stored on the end-user device under its assigned name. It simply never reaches the SDK call that needs it under the name that call expects.

Root cause (source-level)

This BYOK feature stores each configured provider's secret material as a single combined blob and tells the client which namespaced environment variable names to read it under, to avoid collisions between multiple same-type providers in one org. For this provider, that is a LPR_<provider-id-suffix>_ prefix:

LPR_NCEED_AWS_ACCESS_KEY_ID
LPR_NCEED_AWS_SECRET_ACCESS_KEY
LPR_NCEED_AWS_REGION
LPR_NCEED_AWS_BEARER_TOKEN_BEDROCK

(The dashboard's own provider edit screen states this explicitly: "On members' machines and cloud workers this provider reads LPR_NCEED_AWS_ACCESS_KEY_ID, ..., LPR_NCEED_AWS_REGION, ..., so it never collides with a key someone set themselves or with another provider of the same kind.")

The actual model-execution engine that constructs the Bedrock client and runs the chat request is OpenCode (sst/opencode, vendored into this project as @opencode-ai/sdk / the bundled desktop runtime binary — a separate upstream project from this repository). Its Bedrock integration uses @ai-sdk/amazon-bedrock, whose settings loader only ever checks for an explicit region constructor option or the literal, unprefixed AWS_REGION environment variable. It has no knowledge of this project's LPR_<suffix>_ namespacing scheme.

Nothing in the glue between these two systems currently bridges the gap. Specifically:

  • ee/packages/utils/src/inference-credentials.ts's inferenceCredentialEnvNames() function (the utility responsible for picking which single namespaced variable is "the" credential to forward for a provider) explicitly excludes any variable name containing REGION by design:

    // ee/packages/utils/src/inference-credentials.ts:4-5
    if (!/^[A-Z][A-Z0-9_]*$/.test(name)
        || /(?:^|_)(?:RESOURCE|PROJECT|LOCATION|REGION|ACCOUNT|TENANT|ENDPOINT|URL|SETTINGS|INPUT|OUTPUT)(?:_|$)/.test(name)) return []

    This is correct and intentional for its stated purpose (/** Only pass env names from the trusted catalog, never request bodies or stored custom config. */ — it's a credential/secret selector, not a settings forwarder) — but it means region-like "settings" variables are a known, named category in this codebase's own design, and nothing else appears to perform the complementary job of forwarding that category under names the downstream AI SDK provider actually understands.

  • The BYOK provider-creation route itself, ee/apps/den-api/src/routes/org/llm-providers.ts, has no region/settings validation at all for this path. Its normalizeLlmProviderInput() (line 507) only special-cases @ai-sdk/amazon-bedrock/mantle to reject it outright (line 516: "... is available through AI Gateway, not Bring your own keys.") — it never calls anything equivalent to the region check below for the (non-Mantle) @ai-sdk/amazon-bedrock path this bug affects.

  • By contrast, the newer "AI Gateway" feature (a different, parallel credential-set system — ee/apps/den-api/src/llm/gateway-matrix.ts) does this correctly: validateGatewaySettings() (line 28) calls bedrockSettingsError() (ee/apps/den-api/src/llm/inference-provider-config.ts:150), which explicitly requires isAwsRegion(settings.region) (line 151: "Amazon Bedrock requires an AWS region code such as us-east-1.") before a Bedrock provider can even be saved. This confirms the project's own code already has a correct model for how Bedrock region handling should work — it just isn't wired through on the legacy BYOK path this bug affects, and even that correct gateway-side validation is about the save-time check, not the actual runtime SDK-settings bridging, which is the separate gap described above.

Version scope

Checked via direct tag comparison against different-ai/openwork (the upstream this project is published from): ee/apps/den-api/src/llm/gateway-matrix.ts, inference-provider-config.ts, and ee/packages/utils/src/inference-credentials.ts are unchanged between v0.18.42 and v0.18.54 (the version range covered by this deployment's recent upgrade). This is not a regression introduced by any version bump — it has been present at least since the "AI Gateway" / Bedrock support work landed (around v0.18.52-v0.18.54, commit feat(gateway): support Amazon Bedrock and Bedrock Mantle) and is still present in the latest release as of this writing.

Steps to reproduce

  1. As an org owner/admin, go to Settings → AI Gateway → AI Providers → Legacy Providers → Add legacy provider.
  2. Choose Amazon Bedrock (@ai-sdk/amazon-bedrock, not the /mantle variant) as a models.dev-sourced provider.
  3. Supply valid values for all four declared env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION (e.g. us-east-1), AWS_BEARER_TOKEN_BEDROCK.
  4. Select any model from this provider's catalog — tested working with both a plain model ID (e.g. anthropic.claude-<model>) and a cross-region global.anthropic.claude-<model> ID; both fail identically.
  5. Grant yourself access, save.
  6. In the OpenWork desktop app, start a new chat session, explicitly select a model from this provider, and send any prompt.

Expected: the request proceeds to the selected Bedrock model.

Actual: the request fails immediately with:

ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
...
AWS region setting is missing. Pass it using the 'region' parameter or the AWS_REGION environment variable.

Confirmed present in Settings → Environment on the same device: LPR_<suffix>_AWS_REGION (correct, non-empty value) alongside the other three provider variables, all under the same LPR_<suffix>_ prefix.

Suggested fix direction

Somewhere in the boundary between this project's BYOK credential delivery and the OpenCode engine's provider construction, each declared "settings" env var for a provider (region for AWS; resourceName for Azure; project/location for Google Vertex — the same category inferenceCredentialEnvNames() already excludes from credential-forwarding) needs to also be resolved and either:

  • re-exposed under the bare name the target AI SDK provider expects (e.g. LPR_NCEED_AWS_REGION → AWS_REGION in the process actually constructing the Bedrock client), or
  • passed explicitly as the relevant constructor option (region: ...) when that provider client is instantiated.

Additionally, the BYOK (llm-providers.ts) save path should likely reuse bedrockSettingsError() / an equivalent settings validator — currently only the newer Gateway path enforces this at save time, so a BYOK Bedrock provider can be saved and silently fail at every single request instead of being rejected immediately with a clear message.

Where to file

This likely needs attention from both projects:

  • different-ai/openwork — owns the LPR_<suffix>_ naming/forwarding scheme, the BYOK save-time validation gap, and inferenceCredentialEnvNames()'s settings/credential split.
  • sst/opencode — owns the actual Bedrock provider construction and SessionPrompt.getModel/.run code that ultimately needs the resolved region.

To Reproduce

  1. enroll AWS Bedrock (following documentation)
  2. assign it to people or teams
  3. as a user, try to use it ...

Expected behavior

as a user, one should be able to prompt / chat regardless of BYOK provider, Bedrock included

Actual behavior

every chat request against every model attached to that provider fails, regardless of which specific Bedrock model is selected (tested with both a plain, single-region model ID and a cross-region "global." inference-profile model ID — both failed identically), with:

ProviderModelNotFoundError: Model not found: <llmProviderId>/<modelId>.
  ...
AWS region setting is missing. Pass it using the 'region' parameter or the
AWS_REGION environment variable.

Screenshots (optional)

No response

OW version & Desktop info (optional)

No response

Additional context (optional)

NOTE:

AI / AWS-related secrets SHOULD NOT BE EXPOSED in client's user interface, regardless of user role!!!
(any user is allowed to see these keys' values clicking on the eye control... 100% safety elluded)

Activity

  1. added
    bug
    on Oct 6, 2026
  2. added a commit that references this issue on Oct 6, 2026
    f7f2e09
  3. added a commit that references this issue on Oct 6, 2026
    9475d22
  4. raul-gherman-modaoperandi commented on Oct 7, 2026

    @raul-gherman-modaoperandi
    Author

    I am sorry to report back that the issue is not fixed in 0.18.57:

    Image
  5. raul-gherman-modaoperandi commented on Oct 7, 2026

    @raul-gherman-modaoperandi
    Author

    Den 0.18.57, desktop client on linux x86-64 (AppImage), same version

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions