Skip to content

cloudflare: Build-time instrumentation does not run in vite dev #25765

Closed

Description

@andreiborza

With sentryCloudflareVitePlugin, integrations added at build time (e.g. hono, graphql, ai, @anthropic-ai/sdk) send no spans in vite dev. Runtime instrumentation such as D1 works.

Two causes:

  • Vite's dependency optimizer pre-bundles these packages into node_modules/.vite/deps_*/, and the orchestrion transform does not run on optimized deps.
  • When a package is excluded from optimizeDeps, the transform runs but matches nothing: in dev, module ids end with ?v=<hash>, and the file matcher compares paths exactly.

With optimizeDeps.exclude and the query removed from the id, dev sends hono and graphql spans. Excluding ai is not possible, because its CJS deps then fail with module is not defined.

Node + Vite is not affected, because Vite SSR dev does not pre-bundle deps.

Reproduction

https://github.com/andreiborza/cf-vite-d1

  1. pnpm install && pnpm run db:init, then put SENTRY_DSN and OPENROUTER_API_KEY in .env
  2. pnpm start, then pnpm run try:hono, try:graphql, try:weather or try:anthropic: no integration spans
  3. pnpm run build && pnpm run preview, then call the same routes on port 4173: hono, graphql and gen_ai.* spans are sent

Related: #22857, #25677

Activity

  1. linear-code commented on Oct 27, 2026

    @linear-code
  2. added a commit that references this issue on Nov 16, 2026
    23a97ce
  3. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #26264, which was included in the 11.13.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions