Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev-packages/bun-integration-tests/node-suites/excludes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const NO_AUTO_INSTRUMENTATION = [
'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.

'suites/tracing/pi-ai/test.ts',
'suites/tracing/pi-durable/test.ts',
'suites/tracing/postgres/test.ts',
Expand Down
1 change: 1 addition & 0 deletions dev-packages/cloudflare-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@langchain/openai": "^1.6.2",
"@langchain/typesafe": "^0.0.2",
"@opentelemetry/api": "^1.9.1",
"@orpc/server": "2.0.0-beta.51",
"@prisma/adapter-d1": "6.15.0",
"@prisma/client": "6.15.0",
"@sentry-internal/test-utils": "11.16.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ORPCError, os } from '@orpc/server';
import { RPCHandler } from '@orpc/server/fetch';

const router = {
planet: {
find: os.handler(() => ({ name: 'Earth' })),
crash: os.handler(() => {
throw new Error('Sentry Test Error');
}),
missing: os.handler(() => {
throw new ORPCError('NOT_FOUND');
}),
},
};

// At module scope, as in most apps. The vite plugin hooks only per-request oRPC internals.
const handler = new RPCHandler(router);

export default {
async fetch(request, _env, _ctx) {
const { matched, response } = await handler.handle(request, { prefix: '/rpc' });
return matched ? response : new Response('Not found', { status: 404 });
},
} satisfies ExportedHandler;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as Sentry from '@sentry/cloudflare';

interface Env {
SENTRY_DSN: string;
}

export default Sentry.defineCloudflareOptions((env: Env) => ({
dsn: env.SENTRY_DSN,
tracesSampleRate: 1,
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { SENTRY_OP, SENTRY_ORIGIN } from '@sentry/conventions/attributes';
import { RPC } from '@sentry/conventions/op';
import { expect, it } from 'vitest';
import { createRunner } from '../../../../runner';

const ORIGIN = { type: 'string', value: 'auto.rpc.orpc' };

const JSON_REQUEST = {
headers: { 'content-type': 'application/json' },
data: JSON.stringify({ json: { name: 'Earth' } }),
};

it('records one span for a procedure call and names the transaction after the procedure', async ({ signal }) => {
const runner = createRunner(__dirname).ignore('event').start(signal);

const spansPromise = runner.collectStreamedSpans(spansOfTrace =>
spansOfTrace.some(span => span.name === 'planet/find' && !span.is_segment),
);

await runner.makeRequest('post', '/rpc/planet/find', JSON_REQUEST);

const spans = await spansPromise;
expect(spans.find(span => span.is_segment)?.name).toBe('planet/find');
expect(spans.filter(span => span.attributes?.[SENTRY_ORIGIN]?.value === ORIGIN.value)).toEqual([
expect.objectContaining({
name: 'planet/find',
is_segment: false,
attributes: expect.objectContaining({
[SENTRY_OP]: { type: 'string', value: RPC },
[SENTRY_ORIGIN]: ORIGIN,
'rpc.method': { type: 'string', value: 'planet/find' },
}),
}),
]);
});

it('captures errors thrown by procedures, but not 4xx ORPCErrors', async ({ signal }) => {
const runner = createRunner(__dirname)
.ignore('span')
.expect(envelope => {
const event = envelope[1][0]?.[1] as {
transaction?: string;
exception?: { values?: Array<{ value?: string; mechanism?: unknown }> };
contexts?: Record<string, unknown>;
};
expect(event.transaction).toBe('planet/crash');
expect(event.exception?.values?.[0]).toMatchObject({
type: 'Error',
value: 'Sentry Test Error',
mechanism: { type: 'auto.rpc.orpc', handled: false },
});
expect(event.contexts?.orpc).toMatchObject({ procedure_path: 'planet/crash' });
})
.start(signal);

// Sent first, so an event for it would fail the expectation above.
await runner.makeRequest('post', '/rpc/planet/missing', { ...JSON_REQUEST, expectError: true });
await runner.makeRequest('post', '/rpc/planet/crash', { ...JSON_REQUEST, expectError: true });
await runner.completed();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { cloudflare } from '@cloudflare/vite-plugin';
import { sentryCloudflareVitePlugin } from '@sentry/cloudflare/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [cloudflare(), sentryCloudflareVitePlugin()],
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "orpc-worker",
"compatibility_date": "2026-04-26",
"main": "index.ts",
"compatibility_flags": ["nodejs_compat"],
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function register() {
tracePropagationTargets: [
'http://localhost:3030/propagation/test-outgoing-fetch/check',
'http://localhost:3030/propagation/test-outgoing-http/check',
'http://localhost:3030/rpc',
],
});
}
Expand Down
20 changes: 0 additions & 20 deletions dev-packages/e2e-tests/test-applications/nextjs-14/orpc/client.ts

This file was deleted.

45 changes: 0 additions & 45 deletions dev-packages/e2e-tests/test-applications/nextjs-14/orpc/router.ts

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"test:assert": "pnpm test:test-build && pnpm test:prod && pnpm test:dev"
},
"dependencies": {
"@orpc/client": "^1.16.3",
"@orpc/server": "^1.16.3",
"@sentry/nextjs": "file:../../packed/sentry-nextjs-packed.tgz",
"@sentry/core": "file:../../packed/sentry-core-packed.tgz",
"@types/node": "^18.19.1",
Expand All @@ -22,8 +20,7 @@
"next": "14.2.35",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "~5.0.0",
"zod": "^4.6.6"
"typescript": "~5.0.0"
},
"devDependencies": {
"@playwright/test": "1.64.1",
Expand Down

This file was deleted.

Loading
Loading