Skip to content

docs(cloudflare): Add Vite usage - #18844

Open
JPeer264 wants to merge 1 commit into
masterfrom
jp/cloudflare-vite
Open

docs(cloudflare): Add Vite usage#18844
JPeer264 wants to merge 1 commit into
masterfrom
jp/cloudflare-vite

Conversation

@JPeer264

Copy link
Copy Markdown
Member

DESCRIBE YOUR PR

With that we recommend to use Vite instead of plain wrangler. This also documents the new 2 experimental flags with useDiagnosticsChannelInjection and autoInstrument. In the quick start we even add useDiagnosticsChannelInjection in order to get the most out of the instrumentations

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.): This should be out asap.
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@JPeer264
JPeer264 requested review from a team, andreiborza and s1gr1d July 27, 2026 17:46
@JPeer264 JPeer264 self-assigned this Jul 27, 2026
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview Jul 27, 2026 5:46pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Jul 27, 2026 5:46pm

Request Review


The Sentry Cloudflare Vite plugin (`sentryCloudflareVitePlugin`) instruments your Worker at build time. It can:

1. **Instrument bundled dependencies** — injects [`diagnostics_channel.tracingChannel`](https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel) calls into supported packages (such as database clients like `mysql`) so the SDK can trace them without monkey-patching, which the Cloudflare Workers runtime (`workerd`) doesn't support. This gives you more traces out of the box.

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.

l: For me this explains internal details too much. I wouldn't even talk about injecting channels and whatnot. Just that it automatically instruments your bundled dependencies at build time?

1. **Instrument bundled dependencies** — injects [`diagnostics_channel.tracingChannel`](https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel) calls into supported packages (such as database clients like `mysql`) so the SDK can trace them without monkey-patching, which the Cloudflare Workers runtime (`workerd`) doesn't support. This gives you more traces out of the box.
2. **Auto-instrument your Worker entry** — optionally wraps your default export with `Sentry.withSentry()` and Durable Objects with `instrumentDurableObjectWithSentry()` at build time, so you don't need to modify your code.

**We recommend building your Cloudflare Worker with Vite and this plugin.** It's the most complete way to get tracing for bundled dependencies in the Workers runtime, where runtime monkey-patching isn't available. If you already deploy with `wrangler` directly, see [Migrating From Wrangler](#migrating-from-wrangler).

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.

Suggested change
**We recommend building your Cloudflare Worker with Vite and this plugin.** It's the most complete way to get tracing for bundled dependencies in the Workers runtime, where runtime monkey-patching isn't available. If you already deploy with `wrangler` directly, see [Migrating From Wrangler](#migrating-from-wrangler).
**We recommend building your Cloudflare Worker with Vite and the `sentryCloudflareVitePlugin` plugin.** It's the most complete way to get tracing for bundled dependencies in the Workers runtime, where runtime monkey-patching isn't available. If you already deploy with `wrangler` directly, see [Migrating From Wrangler](#migrating-from-wrangler).

1. **Instrument bundled dependencies** — injects [`diagnostics_channel.tracingChannel`](https://nodejs.org/api/diagnostics_channel.html#class-tracingchannel) calls into supported packages (such as database clients like `mysql`) so the SDK can trace them without monkey-patching, which the Cloudflare Workers runtime (`workerd`) doesn't support. This gives you more traces out of the box.
2. **Auto-instrument your Worker entry** — optionally wraps your default export with `Sentry.withSentry()` and Durable Objects with `instrumentDurableObjectWithSentry()` at build time, so you don't need to modify your code.

**We recommend building your Cloudflare Worker with Vite and this plugin.** It's the most complete way to get tracing for bundled dependencies in the Workers runtime, where runtime monkey-patching isn't available. If you already deploy with `wrangler` directly, see [Migrating From Wrangler](#migrating-from-wrangler).

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.

l: I wouldn't talk about runtime monkey-patching. Again, too much internal detail. I'd just drop the "when runtime monkey-patchign isn't available" as a whole.

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