Skip to content

docs(cloudflare): Update Cloudflare docs, also suggest new entrypoint#298

Merged
JPeer264 merged 1 commit into
mainfrom
jp/better-cloudflare-setup
Jul 23, 2026
Merged

docs(cloudflare): Update Cloudflare docs, also suggest new entrypoint#298
JPeer264 merged 1 commit into
mainfrom
jp/better-cloudflare-setup

Conversation

@JPeer264

Copy link
Copy Markdown
Member

This is now in sync with the docs.

This also adds the enableRpcTracePropagation flag (and is also the recommended approach).

@JPeer264
JPeer264 requested review from andreiborza and sergical July 22, 2026 13:09
@JPeer264 JPeer264 self-assigned this Jul 22, 2026
Comment thread src/references/sdks/cloudflare/tracing.md
@JPeer264
JPeer264 force-pushed the jp/better-cloudflare-setup branch from c5edfa8 to 2cb1201 Compare July 22, 2026 16:28
Comment on lines +170 to +176
content: m.parts
.filter((p) => p.type === "text")
.map((p) => p.text)
.join(""),
})),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The onChatMessage example incorrectly uses env.AI.run() and returns a static JSON response, but the agent requires a streaming response, which will break chat functionality.
Severity: CRITICAL

Suggested Fix

Update the example to use the canonical pattern for streaming responses. This involves replacing env.AI.run() with a streaming API like streamText() from the Vercel AI SDK and returning its streaming output, potentially using helpers like convertToModelMessages().

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: src/references/sdks/cloudflare/tracing.md#L170-L176

Potential issue: The documentation example for `AIChatAgent.onChatMessage` demonstrates
an incorrect implementation. It uses `env.AI.run()` and returns a static JSON response
via `new Response(JSON.stringify(result))`. However, the `onChatMessage` handler is
designed to work with streaming responses, and the `AIChatAgent` expects a streaming
response to function correctly. Following the current example will result in a
non-functional chat agent because the client-side infrastructure expects a data stream,
not a single JSON payload. The canonical pattern involves using a streaming API like
`streamText()` from the Vercel AI SDK.

@sergical sergical left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

);
```

> **Deprecated:** the explicit `Sentry.instrumentD1WithSentry(env.DB)` wrapper still works but is **deprecated and will be removed in v11**. Access `env.DB` directly instead — it's instrumented automatically.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if this needs to be part of the reference, hopefully the agent catches the deprecated flag running typecheck or it's lsp

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reference: https://github.com/getsentry/sentry-for-ai/pull/298/changes#diff-970a25bab0eb084745c1721a1579059748f1dc23f2aa169a3d6ed441809af469R318

The reference you added is solely for removals if users have Sentry.instrumentD1WithSentry set. It is just not necessary anymore.

@JPeer264
JPeer264 merged commit 3f3b15e into main Jul 23, 2026
16 checks passed
@JPeer264
JPeer264 deleted the jp/better-cloudflare-setup branch July 23, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants