Skip to content

feat(node): Add oRPC v2 integration - #26588

Open
sentry-junior[bot] wants to merge 2 commits into
developfrom
feat/orpc-integration
Open

sentry-junior[bot] wants to merge 2 commits into
developfrom
feat/orpc-integration

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds orpcIntegration() for oRPC v2. It's on by default in the server SDKs, the same as Hono, and is exported from @sentry/cloudflare and @sentry/deno too.

  • Spans: each procedure call gets one rpc span named after the procedure path (e.g. planet/find), with origin auto.rpc.orpc and rpc.system.name/rpc.method attributes. When the root span is http.server, the transaction is renamed to the procedure. Direct server-side calls outside a request keep their root name.
  • Errors: procedure errors are captured unhandled and mark the span as errored. The procedure path, and the input when dataCollection allows incoming request bodies, go into an orpc context. ORPCErrors that map to 4xx are skipped by default, which shouldHandleError can change. For event-iterator output, the span ends when the procedure returns, and errors thrown later while the stream is consumed are still captured.
  • nextjs-14 e2e app: the oRPC routes are removed and replaced by a node-integration-tests suite.

Why

Everything runs through one orchestrion hook on executeProcedureInternal in @orpc/server (>=2.0.0-0 <3, so v2 betas match). This function runs the middleware chain and the handler of a procedure call, and it rejects with the original error before oRPC encodes it into a response. No OpenTelemetry and no runtime @orpc/* dependency.

oRPC's global tracer hook (Symbol.for('ORPC_TRACER')) isn't used. It only receives a lossy copy of errors, and it emits many middleware, handler and validation spans. So middleapi/orpc#2493 isn't needed for this integration. There's no client hook either: fetch/http instrumentation already traces and propagates oRPC client requests.

Decided: the integration stays on by default rather than opt-in, and its size growth is accepted. That growth is about +0.6 kB gzipped on @sentry/node, @sentry/node without tracing, and @sentry/aws-serverless.

Supported runtimes: Node, Bun (bundled), Deno and Cloudflare Workers. On Deno, @orpc/server is instrumented by the runtime hook. init() covers imports after it, and --preload=npm:@sentry/deno/import covers static imports. On Cloudflare, the worker must be built with @sentry/cloudflare/vite. The hook runs per request, so a module-scope RPCHandler works on workerd. Limits:

  • No middleware or validation spans, only the procedure span.
  • Spans and errors both depend on the private executeProcedureInternal name. If oRPC renames it, both are silently lost.
  • On Bun, oRPC needs the app to be bundled with @sentry/bun/plugin. Unbundled bun run can't apply orchestrion, so it gets no oRPC spans and no error capture. Bun treats oRPC like the other orchestrion-based integrations, such as Hono and Koa.
  • @sentry/node on Deno doesn't instrument Deno's fetch, so client calls there don't propagate the trace. @sentry/deno and its fetchIntegration do.
  • Browser and Vercel Edge are out of scope.

Open question: a custom errorStatusMap needs a matching shouldHandleError.

Follow-ups: the OpenAPI handler. The lockfile bumps type-fest to 5.10.0 because oRPC requires it.

Ref #16330

via @mydea.

--

View Session [Sentry]

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 670a1b9 (PR test merge using develop at 41856af)

Against: 41856af (develop) · base run #67448

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.26 kB - -
@sentry/browser - with treeshaking flags 28.45 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.33 kB - -
@sentry/browser (incl. Tracing) 52.9 kB - -
@sentry/browser (incl. Tracing Core) 40.32 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.9 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.77 kB - -
@sentry/browser (incl. Tracing, Replay) 92.95 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.78 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.3 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.88 kB - -
@sentry/browser (incl. Feedback) 48.2 kB - -
@sentry/browser (incl. sendFeedback) 30.84 kB - -
@sentry/browser (incl. FeedbackAsync) 35.87 kB - -
@sentry/browser (incl. Metrics) 31.58 kB - -
@sentry/browser (incl. Logs) 31.86 kB - -
@sentry/browser (incl. Metrics & Logs) 32.52 kB - -
@sentry/react 32.27 kB - -
@sentry/react (incl. Tracing) 55.49 kB - -
@sentry/vue 38.45 kB - -
@sentry/vue (incl. Tracing) 55.82 kB - -
@sentry/svelte 30.27 kB - -
@sentry/effect (client) 301.05 kB - -
@sentry/effect (client, incl. Tracing) 308.22 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 311.08 kB - -
@sentry/remix (Remix 3 client bundle) 58.52 kB - -
CDN Bundle 32.19 kB - -
CDN Bundle (incl. Tracing) 53.28 kB - -
CDN Bundle (incl. Logs, Metrics) 34.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.84 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.05 kB - -
CDN Bundle (incl. Tracing, Replay) 91.2 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.17 kB - -
CDN Bundle - uncompressed 93.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.52 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.32 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 165.14 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.55 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.79 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.72 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.34 kB - -
@sentry/nextjs (client) 59.26 kB - -
@sentry/sveltekit (client) 54.15 kB - -
@sentry/core/server 45.75 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 156.35 kB +0.43% +654 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.51 kB +0.06% +47 B 🔺
@sentry/node - without tracing 89.56 kB +0.73% +642 B 🔺
@sentry/node - without channel injection 145.27 kB +0.44% +635 B 🔺
@sentry/aws-serverless 100.2 kB +0.65% +647 B 🔺
@sentry/cloudflare (withSentry) - minified 209.05 kB - -
@sentry/cloudflare (withSentry) 485.09 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 1.04 MB - -
@sentry/nextjs/cloudflare (withSentry) - minified 234.28 kB - -

View base workflow run

@github-actions

Copy link
Copy Markdown
Contributor

One or more gzipped bundles increased by more than 500 bytes. If this increase is intentional, add the Accept Bundlesize Increase label to this PR to rerun and accept the check.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 6 not successful, 58 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Failing after 46s Details
❌ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Failing after 29s Details
❌ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Failing after 31s Details
❌ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Failing after 29s Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Successful in 32s Details

'suites/tracing/openai/v6/test.ts',
'suites/tracing/openai/v7/test.ts',
'suites/tracing/orchestrion-lazy-registration/test.ts',
'suites/tracing/orpc/test.ts',

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.

why does this have to be exlucded? should that not work on bun

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does work on Bun, just not unbundled. NO_AUTO_INSTRUMENTATION only excludes the plain bun run project: bun run can't inject the orchestrion channels (see the comment above the list and #23882), so executeProcedureInternal never publishes and there are no spans or errors. The suite still runs in the bundled node-suites-bun-build project with @sentry/bun/plugin, and it passed there (4/4 locally and in CI). That matches how hono and koa are handled in the same list.

@mydea
mydea marked this pull request as ready for review November 19, 2026 09:05
@sentry-junior
sentry-junior Bot requested a review from mydea November 19, 2026 09:06

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@mydea
mydea force-pushed the feat/orpc-integration branch from a775f44 to f018ced Compare November 19, 2026 12:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f018ced. Configure here.

@mydea

mydea commented Nov 19, 2026

Copy link
Copy Markdown
Member

tests fail, why? if flaky, fix the flakes and rerun

@mydea

mydea commented Nov 20, 2026

Copy link
Copy Markdown
Member

rebase on develop and fix tests

sentry-junior Bot and others added 2 commits November 23, 2026 08:48
Squashed rebase of the branch onto develop. The lockfile is regenerated.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
Nested in-process procedure calls no longer rename the http.server root to
the inner procedure. A throwing shouldHandleError no longer replaces the
original error of an event iterator. The Cloudflare suite now uses the vite
plugin with instrument.server.ts, and the tests use span ops from
@sentry/conventions.

Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
@sentry-junior
sentry-junior Bot force-pushed the feat/orpc-integration branch from 6af7248 to 4336ebd Compare November 23, 2026 09:09

This branch has not been deployed

No deployments
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