Skip to content

Commit c07f2a2

Browse files
authored
Merge pull request #16750 from getsentry/prepare-release/9.33.0
meta(changelog): Update changelog for 9.33.0
2 parents 2bd0c99 + e8eb291 commit c07f2a2

File tree

61 files changed

+1982
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1982
-378
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,49 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 9.33.0
8+
9+
### Important Changes
10+
11+
- **feat: Add opt-in `vercelAiIntegration` to cloudflare & vercel-edge ([#16732](https://github.com/getsentry/sentry-javascript/pull/16732))**
12+
13+
The `vercelAiIntegration` is now available as opt-in for the Cloudflare and the Next.js SDK for Vercel Edge.
14+
To use it, add the integration in `Sentry.init`
15+
16+
```js
17+
Sentry.init({
18+
tracesSampleRate: 1.0,
19+
integrations: [Sentry.vercelAIIntegration()],
20+
});
21+
```
22+
23+
And enable telemetry for Vercel AI calls
24+
25+
```js
26+
const result = await generateText({
27+
model: openai('gpt-4o'),
28+
experimental_telemetry: {
29+
isEnabled: true,
30+
},
31+
});
32+
```
33+
34+
- **feat(node): Add postgresjs instrumentation ([#16665](https://github.com/getsentry/sentry-javascript/pull/16665))**
35+
36+
The Node.js SDK now includes instrumentation for [Postgres.js](https://www.npmjs.com/package/postgres).
37+
38+
- **feat(node): Use diagnostics channel for Fastify v5 error handling ([#16715](https://github.com/getsentry/sentry-javascript/pull/16715))**
39+
40+
If you're on Fastify v5, you no longer need to call `setupFastifyErrorHandler`. It is done automatically by the node SDK. Older versions still rely on calling `setupFastifyErrorHandler`.
41+
42+
### Other Changes
43+
44+
- feat(cloudflare): Allow interop with OpenTelemetry emitted spans ([#16714](https://github.com/getsentry/sentry-javascript/pull/16714))
45+
- feat(cloudflare): Flush after `waitUntil` ([#16681](https://github.com/getsentry/sentry-javascript/pull/16681))
46+
- fix(nextjs): Remove `ai` from default server external packages ([#16736](https://github.com/getsentry/sentry-javascript/pull/16736))
47+
48+
Work in this release was contributed by @0xbad0c0d3. Thank you for your contribution!
49+
750
## 9.32.0
851

952
### Important Changes
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
// Force this so that the initial sampleRand is consistent
6+
Math.random = () => 0.45;
7+
8+
Sentry.init({
9+
dsn: 'https://[email protected]/1337',
10+
integrations: [Sentry.browserTracingIntegration()],
11+
tracePropagationTargets: ['http://sentry-test-site.example'],
12+
tracesSampler: ({ name }) => {
13+
if (name === 'new-trace') {
14+
return 0.9;
15+
}
16+
17+
return 0.5;
18+
},
19+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const newTraceBtn = document.getElementById('newTrace');
2+
newTraceBtn.addEventListener('click', async () => {
3+
Sentry.startNewTrace(() => {
4+
// We want to ensure the new trace is sampled, so we force the sample_rand to a value above 0.9
5+
Sentry.getCurrentScope().setPropagationContext({
6+
...Sentry.getCurrentScope().getPropagationContext(),
7+
sampleRand: 0.85,
8+
});
9+
Sentry.startSpan({ op: 'ui.interaction.click', name: 'new-trace' }, async () => {
10+
await fetch('http://sentry-test-site.example');
11+
});
12+
});
13+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
</head>
6+
<body>
7+
<button id="newTrace">new Trace</button>
8+
</body>
9+
</html>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import { expect } from '@playwright/test';
2+
import { sentryTest } from '../../../../utils/fixtures';
3+
import type { EventAndTraceHeader } from '../../../../utils/helpers';
4+
import {
5+
eventAndTraceHeaderRequestParser,
6+
getFirstSentryEnvelopeRequest,
7+
shouldSkipTracingTest,
8+
waitForTransactionRequest,
9+
} from '../../../../utils/helpers';
10+
11+
sentryTest(
12+
'new trace started with `startNewTrace` is sampled according to the `tracesSampler`',
13+
async ({ getLocalTestUrl, page }) => {
14+
if (shouldSkipTracingTest()) {
15+
sentryTest.skip();
16+
}
17+
18+
const url = await getLocalTestUrl({ testDir: __dirname });
19+
20+
await page.route('http://sentry-test-site.example/**', route => {
21+
return route.fulfill({
22+
status: 200,
23+
contentType: 'application/json',
24+
body: JSON.stringify({}),
25+
});
26+
});
27+
28+
const [pageloadEvent, pageloadTraceHeaders] = await getFirstSentryEnvelopeRequest<EventAndTraceHeader>(
29+
page,
30+
url,
31+
eventAndTraceHeaderRequestParser,
32+
);
33+
34+
const pageloadTraceContext = pageloadEvent.contexts?.trace;
35+
36+
expect(pageloadEvent.type).toEqual('transaction');
37+
38+
expect(pageloadTraceContext).toMatchObject({
39+
op: 'pageload',
40+
trace_id: expect.stringMatching(/^[0-9a-f]{32}$/),
41+
span_id: expect.stringMatching(/^[0-9a-f]{16}$/),
42+
data: {
43+
'sentry.sample_rate': 0.5,
44+
},
45+
});
46+
expect(pageloadTraceContext).not.toHaveProperty('parent_span_id');
47+
48+
expect(pageloadTraceHeaders).toEqual({
49+
environment: 'production',
50+
public_key: 'public',
51+
sample_rate: '0.5',
52+
sampled: 'true',
53+
trace_id: pageloadTraceContext?.trace_id,
54+
sample_rand: '0.45',
55+
});
56+
57+
const transactionPromise = waitForTransactionRequest(page, event => {
58+
return event.transaction === 'new-trace';
59+
});
60+
61+
await page.locator('#newTrace').click();
62+
63+
const [newTraceTransactionEvent, newTraceTransactionTraceHeaders] = eventAndTraceHeaderRequestParser(
64+
await transactionPromise,
65+
);
66+
67+
const newTraceTransactionTraceContext = newTraceTransactionEvent.contexts?.trace;
68+
expect(newTraceTransactionTraceContext).toMatchObject({
69+
op: 'ui.interaction.click',
70+
trace_id: expect.stringMatching(/^[0-9a-f]{32}$/),
71+
span_id: expect.stringMatching(/^[0-9a-f]{16}$/),
72+
data: {
73+
'sentry.sample_rate': 0.9,
74+
},
75+
});
76+
77+
expect(newTraceTransactionTraceHeaders).toEqual({
78+
environment: 'production',
79+
public_key: 'public',
80+
sample_rate: '0.9',
81+
sampled: 'true',
82+
trace_id: newTraceTransactionTraceContext?.trace_id,
83+
transaction: 'new-trace',
84+
sample_rand: '0.85',
85+
});
86+
87+
expect(newTraceTransactionTraceContext?.trace_id).not.toEqual(pageloadTraceContext?.trace_id);
88+
},
89+
);

dev-packages/e2e-tests/test-applications/create-next-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"test:prod": "TEST_ENV=prod playwright test",
99
"test:dev": "TEST_ENV=dev playwright test",
1010
"test:build": "pnpm install && pnpm build",
11-
"test:build-13": "pnpm install && pnpm add next@13.4.19 && pnpm build",
11+
"test:build-13": "pnpm install && pnpm add next@13.5.9 && pnpm build",
1212
"test:assert": "pnpm test:prod && pnpm test:dev"
1313
},
1414
"dependencies": {
1515
"@sentry/nextjs": "latest || *",
1616
"@types/node": "^18.19.1",
1717
"@types/react": "18.0.26",
1818
"@types/react-dom": "18.0.9",
19-
"next": "14.0.0",
19+
"next": "14.2.25",
2020
"react": "18.2.0",
2121
"react-dom": "18.2.0",
2222
"typescript": "~5.0.0"

dev-packages/e2e-tests/test-applications/nextjs-13/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@types/node": "^18.19.1",
1818
"@types/react": "18.0.26",
1919
"@types/react-dom": "18.0.9",
20-
"next": "13.5.7",
20+
"next": "13.5.9",
2121
"react": "18.2.0",
2222
"react-dom": "18.2.0",
2323
"typescript": "~5.0.0"

dev-packages/e2e-tests/test-applications/nextjs-app-dir/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"test:test-build": "pnpm ts-node --script-mode assert-build.ts",
1212
"test:build-canary": "pnpm install && pnpm add next@canary && pnpm add react@beta && pnpm add react-dom@beta && pnpm build",
1313
"test:build-latest": "pnpm install && pnpm add next@latest && pnpm build",
14-
"test:build-13": "pnpm install && pnpm add next@13.4.19 && pnpm build",
14+
"test:build-13": "pnpm install && pnpm add next@13.5.9 && pnpm build",
1515
"test:assert": "pnpm test:test-build && pnpm test:prod && pnpm test:dev"
1616
},
1717
"dependencies": {

dev-packages/e2e-tests/test-applications/node-fastify-5/src/app.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ const app = fastify();
3434
const port = 3030;
3535
const port2 = 3040;
3636

37-
Sentry.setupFastifyErrorHandler(app);
38-
3937
app.get('/test-success', function (_req, res) {
4038
res.send({ version: 'v1' });
4139
});

dev-packages/e2e-tests/test-applications/nuxt-4/app/app.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
</NuxtLayout>
1414
</template>
1515

16-
<script setup>
16+
<script setup lang="ts">
17+
import { useSentryTestTag } from '#imports';
18+
19+
useSentryTestTag();
1720
</script>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// fixme: this needs to be imported from @sentry/core, not @sentry/nuxt in dev mode (because of import-in-the-middle error)
2+
// This could also be a problem with the specific setup of the pnpm E2E test setup, because this could not be reproduced outside of the E2E test.
3+
// Related to this: https://github.com/getsentry/sentry-javascript/issues/15204#issuecomment-2948908130
4+
import { setTag } from '@sentry/nuxt';
5+
6+
export default function useSentryTestTag(): void {
7+
setTag('test-tag', null);
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineNuxtModule } from 'nuxt/kit';
2+
3+
// Just a fake module to check if the SDK works alongside other local Nuxt modules without breaking the build
4+
export default defineNuxtModule({
5+
meta: { name: 'another-module' },
6+
setup() {
7+
console.log('another-module setup called');
8+
},
9+
});

dev-packages/e2e-tests/test-applications/nuxt-4/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
export default defineNuxtConfig({
33
future: { compatibilityVersion: 4 },
4-
compatibilityDate: '2024-04-03',
4+
compatibilityDate: '2025-06-06',
55
imports: { autoImport: false },
66

77
modules: ['@pinia/nuxt', '@sentry/nuxt/module'],

dev-packages/e2e-tests/test-applications/nuxt-4/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@pinia/nuxt": "^0.5.5",
2020
"@sentry/nuxt": "latest || *",
21-
"nuxt": "^3.13.2"
21+
"nuxt": "^3.17.5"
2222
},
2323
"devDependencies": {
2424
"@playwright/test": "~1.50.0",

dev-packages/node-integration-tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"node-cron": "^3.0.3",
6262
"node-schedule": "^2.1.1",
6363
"pg": "8.16.0",
64+
"postgres": "^3.4.7",
6465
"proxy": "^2.1.1",
6566
"redis-4": "npm:redis@^4.6.14",
6667
"reflect-metadata": "0.2.1",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3.9'
2+
3+
services:
4+
db:
5+
image: postgres:13
6+
restart: always
7+
container_name: integration-tests-postgresjs
8+
ports:
9+
- '5444:5432'
10+
environment:
11+
POSTGRES_USER: test
12+
POSTGRES_PASSWORD: test
13+
POSTGRES_DB: test_db
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
2+
const Sentry = require('@sentry/node');
3+
4+
Sentry.init({
5+
dsn: 'https://[email protected]/1337',
6+
release: '1.0',
7+
tracesSampleRate: 1.0,
8+
transport: loggingTransport,
9+
});
10+
11+
// Stop the process from exiting before the transaction is sent
12+
setInterval(() => {}, 1000);
13+
14+
const postgres = require('postgres');
15+
16+
const sql = postgres({ port: 5444, user: 'test', password: 'test', database: 'test_db' });
17+
18+
async function run() {
19+
await Sentry.startSpan(
20+
{
21+
name: 'Test Transaction',
22+
op: 'transaction',
23+
},
24+
async () => {
25+
try {
26+
await sql`
27+
CREATE TABLE "User" ("id" SERIAL NOT NULL,"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,"email" TEXT NOT NULL,"name" TEXT,CONSTRAINT "User_pkey" PRIMARY KEY ("id"));
28+
`;
29+
30+
await sql`
31+
INSERT INTO "User" ("email", "name") VALUES ('Foo', '[email protected]');
32+
`;
33+
34+
await sql`
35+
UPDATE "User" SET "name" = 'Foo' WHERE "email" = '[email protected]';
36+
`;
37+
38+
await sql`
39+
SELECT * FROM "User" WHERE "email" = '[email protected]';
40+
`;
41+
42+
await sql`SELECT * from generate_series(1,1000) as x `.cursor(10, async rows => {
43+
await Promise.all(rows);
44+
});
45+
46+
await sql`
47+
DROP TABLE "User";
48+
`;
49+
50+
// This will be captured as an error as the table no longer exists
51+
await sql`
52+
SELECT * FROM "User" WHERE "email" = '[email protected]';
53+
`;
54+
} finally {
55+
await sql.end();
56+
}
57+
},
58+
);
59+
}
60+
61+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
62+
run();

0 commit comments

Comments
 (0)