Skip to content

Commit e0b1dc3

Browse files
isaacsclaude
andcommitted
feat(node, bun, deno, cloudflare): Align portable exports across server SDKs
The server SDKs export different sets of helpers from `@sentry/core` and `@sentry/server-utils`, although the helpers work on each runtime. A user who moves between runtimes, or follows docs written for another one, finds a helper missing. Two of the gaps also hide default integrations: Node and Bun add `awsIntegration` to their defaults, and Deno adds `fastifyIntegration`, but they did not export them. A user who sets `defaultIntegrations` could not add them back. - Node and Bun now export `moduleMetadataIntegration`, `instrumentPostgresJsSql`, `instrumentCreateReactAgent`, `awsIntegration` and the `FlueOptions` type. `@sentry/aws-serverless` and `@sentry/google-cloud-serverless` re-export the new Node values, as the consistent exports check requires. - Deno and Cloudflare now export `parameterize` and `instrumentStateGraphCompile`, so all four runtimes export the same LangGraph helpers. - Bun and Cloudflare now export the `Log` and `LogSeverityLevel` types. - Deno now exports `fastifyIntegration`. Cloudflare's channel integrations (express, pg and so on) are separate work, because they need a warning when the vite plugin is missing. Fixes #25574 Fixes JS-3972 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 0df3e5e commit e0b1dc3

13 files changed

Lines changed: 107 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ Work in this release was contributed by @adityareddy-dev, @jpdefo, @Jxxunnn, @ph
6969

7070
`ignoreStaticAssets` defaults to `true`, so workers no longer create spans for `GET` requests to common static assets such as `favicon.ico`, `robots.txt` or `*.js` files. To keep these spans, set `httpServerIntegration({ ignoreStaticAssets: false })`. Request spans also follow the client's tracing configuration by default, so the SDK does not start them when tracing is disabled. If `ignoreRequestBody` throws, the request no longer fails, and the SDK skips the body.
7171

72+
- **feat(node, bun, deno, cloudflare): Align portable exports across server SDKs**
73+
74+
Node, Bun, Deno and Cloudflare now export the same helpers from `@sentry/core` and `@sentry/server-utils` where they work on that runtime:
75+
76+
- Node and Bun now export `moduleMetadataIntegration`, `instrumentPostgresJsSql`, `instrumentCreateReactAgent`, `awsIntegration` and the `FlueOptions` type. `awsIntegration` was already in their default integrations.
77+
- Deno and Cloudflare now export `parameterize` and `instrumentStateGraphCompile`.
78+
- Bun and Cloudflare now export the `Log` and `LogSeverityLevel` types.
79+
- Deno now exports `fastifyIntegration`, which was already in its default integrations.
80+
7281
## 11.8.0
7382

7483
### Important Changes
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as Sentry from '@sentry/cloudflare';
2+
3+
interface Env {
4+
SENTRY_DSN: string;
5+
}
6+
7+
export default Sentry.withSentry(
8+
(env: Env) => ({
9+
dsn: env.SENTRY_DSN,
10+
}),
11+
{
12+
async fetch(_request, _env, _ctx) {
13+
const userId = 42;
14+
Sentry.captureMessage(Sentry.parameterize`User ${userId} logged in`);
15+
return new Response('ok');
16+
},
17+
},
18+
);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Event } from '@sentry/core';
2+
import { expect, it } from 'vitest';
3+
import { createRunner } from '../../../runner';
4+
5+
it('parameterize from the public entry sends a message template and its values', async ({ signal }) => {
6+
const runner = createRunner(__dirname)
7+
.expect(envelope => {
8+
const event = envelope[1]?.[0]?.[1] as Event;
9+
expect(event.logentry).toEqual({ message: 'User %s logged in', params: [42] });
10+
})
11+
.start(signal);
12+
13+
await runner.makeRequest('get', '/');
14+
await runner.completed();
15+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "worker-name",
3+
"compatibility_date": "2025-06-17",
4+
"main": "index.ts",
5+
"compatibility_flags": ["nodejs_compat"],
6+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// <reference lib="deno.ns" />
2+
3+
import * as Sentry from '@sentry/deno';
4+
import { assertEquals } from 'https://deno.land/std@0.212.0/assert/assert_equals.ts';
5+
import { errorSink, resetGlobals, withTimeout } from '../../src/index.ts';
6+
7+
Deno.test('parameterize from the public entry sends a message template and its values', async () => {
8+
resetGlobals();
9+
const sink = errorSink();
10+
11+
Sentry.init({
12+
dsn: 'https://username@domain/123',
13+
beforeSend: sink.beforeSend,
14+
});
15+
16+
const userId = 42;
17+
Sentry.captureMessage(Sentry.parameterize`User ${userId} logged in`);
18+
19+
const event = await withTimeout(
20+
sink.waitFor(e => e.logentry?.message === 'User %s logged in'),
21+
5_000,
22+
'parameterized message event',
23+
);
24+
assertEquals(event.logentry, { message: 'User %s logged in', params: [42] });
25+
});

‎packages/astro/src/index.server.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export {
1313
addIntegration,
1414
amqplibIntegration,
1515
anthropicAIIntegration,
16+
awsIntegration,
1617
// eslint-disable-next-line typescript/no-deprecated
1718
anrIntegration,
1819
googleGenAIIntegration,
@@ -102,6 +103,7 @@ export {
102103
langChainIntegration,
103104
langGraphIntegration,
104105
createFlueInstrumentation,
106+
instrumentPostgresJsSql,
105107
mastraIntegration,
106108
piDurableIntegration,
107109
mcpServerIntegration,
@@ -177,6 +179,8 @@ export {
177179
instrumentLangChainEmbeddings,
178180
instrumentStateGraph,
179181
instrumentStateGraphCompile,
182+
instrumentCreateReactAgent,
183+
moduleMetadataIntegration,
180184
zodErrorsIntegration,
181185
profiler,
182186
logger,

‎packages/aws-serverless/src/index.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export {
22
addEventProcessor,
33
addBreadcrumb,
44
addIntegration,
5+
moduleMetadataIntegration,
56
captureException,
67
captureEvent,
78
captureMessage,
@@ -71,6 +72,7 @@ export {
7172
mcpServerIntegration,
7273
SentryMastraExporter,
7374
createFlueInstrumentation,
75+
instrumentPostgresJsSql,
7476
modulesIntegration,
7577
nodeRuntimeMetricsIntegration,
7678
type NodeRuntimeMetricsOptions,
@@ -159,6 +161,7 @@ export {
159161
instrumentGoogleGenAIClient,
160162
instrumentStateGraph,
161163
instrumentStateGraphCompile,
164+
instrumentCreateReactAgent,
162165
zodErrorsIntegration,
163166
profiler,
164167
amqplibIntegration,

‎packages/bun/src/index.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export type {
1010
Exception,
1111
Session,
1212
SeverityLevel,
13+
Log,
14+
LogSeverityLevel,
1315
Span,
1416
StackFrame,
1517
Stacktrace,
@@ -25,6 +27,7 @@ export {
2527
addEventProcessor,
2628
addBreadcrumb,
2729
addIntegration,
30+
moduleMetadataIntegration,
2831
captureException,
2932
captureEvent,
3033
captureMessage,
@@ -93,6 +96,8 @@ export {
9396
mcpServerIntegration,
9497
SentryMastraExporter,
9598
createFlueInstrumentation,
99+
type FlueOptions,
100+
instrumentPostgresJsSql,
96101
modulesIntegration,
97102
contextLinesIntegration,
98103
nodeContextIntegration,
@@ -176,6 +181,8 @@ export {
176181
instrumentGoogleGenAIClient,
177182
instrumentStateGraph,
178183
instrumentStateGraphCompile,
184+
instrumentCreateReactAgent,
185+
awsIntegration,
179186
zodErrorsIntegration,
180187
profiler,
181188
amqplibIntegration,

‎packages/cloudflare/src/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type {
1111
FeatureFlagsIntegration,
1212
Session,
1313
SeverityLevel,
14+
Log,
15+
LogSeverityLevel,
1416
Span,
1517
StackFrame,
1618
Stacktrace,
@@ -30,6 +32,7 @@ export {
3032
captureException,
3133
captureEvent,
3234
captureMessage,
35+
parameterize,
3336
captureFeedback,
3437
close,
3538
createTransport,
@@ -139,6 +142,7 @@ export {
139142
createLangChainCallbackHandler,
140143
instrumentLangChainEmbeddings,
141144
instrumentStateGraph,
145+
instrumentStateGraphCompile,
142146
instrumentCreateReactAgent,
143147
vercelAIIntegration,
144148
honoIntegration,

‎packages/deno/src/index.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export {
3030
captureException,
3131
captureEvent,
3232
captureMessage,
33+
parameterize,
3334
captureFeedback,
3435
close,
3536
createTransport,
@@ -122,6 +123,7 @@ export {
122123
createLangChainCallbackHandler,
123124
instrumentLangChainEmbeddings,
124125
instrumentStateGraph,
126+
instrumentStateGraphCompile,
125127
instrumentCreateReactAgent,
126128
} from '@sentry/server-utils';
127129
export type { FlueOptions } from '@sentry/server-utils';
@@ -156,6 +158,7 @@ export {
156158
genericPoolIntegration,
157159
googleGenAIIntegration,
158160
graphqlIntegration,
161+
fastifyIntegration,
159162
hapiIntegration,
160163
honoIntegration,
161164
honoMiddleware,

0 commit comments

Comments
 (0)