Skip to content

fix: Amazon Bedrock Converse requests fail for ARN model IDs containing slashes - #17525

Merged
aayush-kapoor merged 2 commits into
mainfrom
bugfix/17523-1
Jul 20, 2026
Merged

fix: Amazon Bedrock Converse requests fail for ARN model IDs containing slashes#17525
aayush-kapoor merged 2 commits into
mainfrom
bugfix/17523-1

Conversation

@lgrammel

Copy link
Copy Markdown
Collaborator

Background

Amazon Bedrock Converse generation failed and streaming returned empty text when ARN model IDs contained /.

Root Cause

The chat model URL builder decoded %2F in ARN model IDs, splitting the model ID across URL path segments and causing Bedrock to return an UnknownOperationException; route-sensitive regression tests confirmed the malformed path.

Summary

Restored full percent-encoding of model IDs when constructing Amazon Bedrock Converse and ConverseStream URLs.

Testing

Updated the existing chat language model tests with route-sensitive generate and stream coverage using inline snapshots, and added a patch changeset.

End-to-end Validation

  • pnpm -C packages/amazon-bedrock build && pnpm -C examples/ai-functions exec tsx src/reproduction/issue-17523-bedrock-arn-model-id.ts — live Bedrock generation and streaming succeeded with the inference-profile ARN, returning assistant text and finish reason length.

Related Issues

Fixes #17523

Closes #17524

Co-authored-by: PaulBanusIAD 120463976+PaulBanusIAD@users.noreply.github.com

@lgrammel

Copy link
Copy Markdown
Collaborator Author

Bugfix review

Outcome: approved

Reproduction replay

Status: no-longer-reproduces

The exact original reproduction completed successfully and the original bug signal did not appear.

Fixes issue

Status: fully-addresses

The URL builder now fully percent-encodes model IDs, keeping ARN slashes within the modelId path segment for both Converse generation and streaming. The generic implementation covers application inference profiles, foundation-model ARNs, and other slash-containing ARN forms.

Side effects

Risk: low

The change restores the encoding behavior used before the regression and leaves ordinary model IDs functionally unchanged. It affects only construction of Bedrock chat-model request URLs.

Performance

Risk: none

The change removes conditional checks and two replacement passes, adding no persistent allocations, buffering, or additional network work.

Backwards compatibility

Risk: none

This request-time URL construction change does not read, migrate, or modify stored data and restores previously working ARN behavior.

Security

Risk: none

No authentication or credential handling changes were introduced; encoding reserved path characters reduces path-segment ambiguity rather than expanding it.

Testing

Status: appropriate

Route-sensitive regression tests cover successful Converse generation and ConverseStream output with a slash-containing ARN, while the authoritative replay exercises the original live workflow. The complete package test suites passed in both Node and edge environments.

Verification

Reviewed the three-file diff and relevant history, confirmed application-profile and foundation-model ARN slashes are encoded, and found the diff check clean. The Amazon Bedrock package build and type-check passed, as did all 414 Node tests and all 414 edge tests.

Relevant Documentation

@aayush-kapoor
aayush-kapoor merged commit ce56626 into main Jul 20, 2026
59 checks passed
@aayush-kapoor
aayush-kapoor deleted the bugfix/17523-1 branch July 20, 2026 18:07
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.32 github npm
@ai-sdk/alibaba 2.0.15 github npm
@ai-sdk/amazon-bedrock 5.0.25 github npm
@ai-sdk/angular 3.0.32 github npm
@ai-sdk/baseten 2.0.13 github npm
@ai-sdk/cerebras 3.0.13 github npm
@ai-sdk/deepinfra 3.0.13 github npm
@ai-sdk/fireworks 3.0.14 github npm
@ai-sdk/gateway 4.0.24 github npm
@ai-sdk/google 4.0.19 github npm
@ai-sdk/google-vertex 5.0.23 github npm
@ai-sdk/harness 1.0.37 github npm
@ai-sdk/harness-claude-code 1.0.38 github npm
@ai-sdk/harness-codex 1.0.39 github npm
@ai-sdk/harness-deepagents 1.0.36 github npm
@ai-sdk/harness-opencode 1.0.38 github npm
@ai-sdk/harness-pi 1.0.37 github npm
@ai-sdk/huggingface 2.0.13 github npm
@ai-sdk/langchain 3.0.32 github npm
@ai-sdk/llamaindex 3.0.32 github npm
@ai-sdk/moonshotai 3.0.16 github npm
@ai-sdk/openai-compatible 3.0.13 github npm
@ai-sdk/otel 1.0.32 github npm
@ai-sdk/policy-opa 1.0.32 github npm
@ai-sdk/react 4.0.35 github npm
@ai-sdk/rsc 3.0.32 github npm
@ai-sdk/sandbox-just-bash 1.0.37 github npm
@ai-sdk/sandbox-vercel 1.0.37 github npm
@ai-sdk/svelte 5.0.32 github npm
@ai-sdk/togetherai 3.0.14 github npm
@ai-sdk/tui 1.0.33 github npm
@ai-sdk/vercel 3.0.13 github npm
@ai-sdk/vue 4.0.32 github npm
@ai-sdk/workflow 1.0.32 github npm
@ai-sdk/workflow-harness 1.0.37 github npm
@ai-sdk/xai 4.0.17 github npm

lgrammel added a commit that referenced this pull request Jul 21, 2026
…ontaining slashes (#17550)

## Background

Amazon Bedrock Converse generation failed and streaming returned empty
text when ARN model IDs contained `/`.

## Root Cause

The chat model URL builder decoded `%2F` in ARN model IDs, splitting the
model ID across URL path segments and causing Bedrock to return an
UnknownOperationException; route-sensitive regression tests confirmed
the malformed path.

## Summary

Restored full percent-encoding of model IDs when constructing Amazon
Bedrock Converse and ConverseStream URLs.

## Testing

Updated the existing chat language model tests with route-sensitive
generate and stream coverage using inline snapshots, and added a patch
changeset.

## End-to-end Validation

- `pnpm -C packages/amazon-bedrock build && pnpm -C
examples/ai-functions exec tsx
src/reproduction/issue-17523-bedrock-arn-model-id.ts` — live Bedrock
generation and streaming succeeded with the inference-profile ARN,
returning assistant text and finish reason `length`.

## Related Issues

Fixes #17523

Closes #17524

Backport of #17525

Co-authored-by: PaulBanusIAD
<120463976+PaulBanusIAD@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants