Skip to content

[v6.0] fix: Amazon Bedrock S3 image URLs are rejected instead of passed through to inference - #17694

Merged
lgrammel merged 2 commits into
release-v6.0from
backport-v6.0/15792-2
Jul 22, 2026
Merged

[v6.0] fix: Amazon Bedrock S3 image URLs are rejected instead of passed through to inference#17694
lgrammel merged 2 commits into
release-v6.0from
backport-v6.0/15792-2

Conversation

@lgrammel

Copy link
Copy Markdown
Collaborator

Background

The published Amazon Bedrock provider rejected S3-hosted images before inference, forcing users to load image bytes into memory.

Root Cause

The model declared no native URL support, causing the core downloader to reject s3:// URLs, while Bedrock message conversion also unconditionally rejected URL-backed files. Reproduction confirmed AI_DownloadError through generateText and AI_UnsupportedFunctionalityError through direct provider use.

Summary

The provider now recognizes s3:// image URLs and serializes user and tool-result images as Bedrock s3Location sources. Bedrock image source types and a patch changeset were updated.

Testing

Added regression coverage for native S3 URL declaration and conversion of user and tool-result S3 images.

End-to-end Validation

  • AWS_REGION=us-east-1 pnpm -C examples/ai-functions exec tsx src/reproduction/amazon-bedrock-s3-image-url.ts using a temporary Nova variant reached live Bedrock and returned Provided S3Location not found, confirming pass-through instead of the previous pre-inference AI_DownloadError.

Related Issues

Fixes #15792

Closes #17676

Backport of #17681

Co-authored-by: tommyOtsai 171396937+tommyOtsai@users.noreply.github.com

@lgrammel

Copy link
Copy Markdown
Collaborator Author

Bugfix review

Outcome: approved

Fixes issue

Status: fully-addresses

The model now declares native s3:// image support to bypass downloading, and provider conversion emits Bedrock image.source.s3Location for user and tool-result images. This matches the documented ImageSource union and required image format.

Side effects

Risk: low

The behavioral change is restricted to s3:// image URLs; HTTP(S) assets retain their existing download behavior, non-S3 direct URLs remain unsupported, and byte-backed images are serialized as before.

Performance

Risk: none

The new path stores and serializes only the S3 URI instead of downloading and base64-encoding image data, reducing memory and processing overhead for the reported workload.

Backwards compatibility

Risk: none

The change does not read, migrate, or rewrite stored data; it only changes construction of new Bedrock inference requests.

Architecture

Risk: none

The URL recognition remains on the Bedrock model while Bedrock-specific source conversion and types remain private to the provider package. No cross-package src imports, dependency reversals, or misplaced shared abstractions were introduced.

Change scope

Status: minimal

All six changed files are directly necessary: provider capability declaration, Bedrock request types and conversion, focused regression tests, and the required patch changeset.

Security

Risk: low

Pass-through is limited to the s3 protocol and delegates object access to Bedrock under the caller's AWS permissions; arbitrary URL schemes are not newly accepted. AWS documents the relevant S3 permission and ownership requirements.

Testing

Status: appropriate

Regression tests cover native URL capability plus exact s3Location conversion for user and tool-result images. The complete provider test suite passed in Node and edge configurations, along with root type checking, provider build, formatting, and lint checks.

Verification

Inspected every diff hunk and relevant prompt-conversion path, compared the reproduced failure path with the fix, confirmed AWS request-schema compatibility, and successfully ran 387 provider tests in both runtime configurations plus type, build, format, lint, and diff checks.

Relevant Documentation

@lgrammel
lgrammel merged commit 7d821cf into release-v6.0 Jul 22, 2026
51 of 52 checks passed
@lgrammel
lgrammel deleted the backport-v6.0/15792-2 branch July 22, 2026 10:16
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 6.0.234 github npm
@ai-sdk/amazon-bedrock 4.0.139 github npm
@ai-sdk/angular 2.0.235 github npm
@ai-sdk/anthropic 3.0.100 github npm
@ai-sdk/anthropic-aws 1.0.22 github npm
@ai-sdk/azure 3.0.92 github npm
@ai-sdk/gateway 3.0.156 github npm
@ai-sdk/google 3.0.99 github npm
@ai-sdk/google-vertex 4.0.168 github npm
@ai-sdk/langchain 2.0.242 github npm
@ai-sdk/llamaindex 2.0.234 github npm
@ai-sdk/openai 3.0.87 github npm
@ai-sdk/react 3.0.236 github npm
@ai-sdk/rsc 2.0.234 github npm
@ai-sdk/svelte 4.0.234 github npm
@ai-sdk/vue 3.0.234 github npm

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