Skip to content

fix(amazon-bedrock): return request body from doGenerate and doStream#14258

Open
giulio-leone wants to merge 1 commit intovercel:mainfrom
giulio-leone:fix/bedrock-request-body-13927
Open

fix(amazon-bedrock): return request body from doGenerate and doStream#14258
giulio-leone wants to merge 1 commit intovercel:mainfrom
giulio-leone:fix/bedrock-request-body-13927

Conversation

@giulio-leone
Copy link
Copy Markdown

Summary

BedrockChatLanguageModel.doGenerate() and doStream() were not returning a request field in their results. This meant consumers relying on request.body (e.g., for observability/tracing) received undefined.

There was an existing // TODO request? comment in the doStream return confirming this was a known gap.

Changes

  • Add request: { body: args } to the return object of doGenerate()
  • Add request: { body: args } to the return object of doStream() (replacing the TODO comment)
  • Add regression tests for both methods verifying the request body is present
  • Update affected snapshots

This matches the pattern used by @ai-sdk/anthropic and other providers.

Test Plan

  • All 345 existing tests pass (node + edge)
  • 2 new regression tests added (should include request body for both doGenerate and doStream)
  • 2 snapshot updates (existing result snapshots now include the new request field)

Fixes #13927

Add `request: { body: args }` to the return objects of both
`doGenerate()` and `doStream()` in BedrockChatLanguageModel, matching
the pattern used by `@ai-sdk/anthropic` and other providers.

Previously the Bedrock provider omitted the request field (with a
`// TODO request?` comment in doStream), causing observability
frameworks like Mastra to receive `undefined` when reading
`request.body` for tracing span inputs.

Fixes vercel#13927

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider labels Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ai-sdk/amazon-bedrock: doStream() and doGenerate() do not return request body

1 participant