Skip to content

Commit 098f205

Browse files
authored
feat(node)!: Add support for Prisma v6 and drop v5 support (#15120)
1 parent 4a5e45d commit 098f205

File tree

10 files changed

+150
-216
lines changed

10 files changed

+150
-216
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@nestjs/common": "10.4.6",
3131
"@nestjs/core": "10.4.6",
3232
"@nestjs/platform-express": "10.4.6",
33-
"@prisma/client": "5.22.0",
33+
"@prisma/client": "6.2.1",
3434
"@sentry/aws-serverless": "8.45.0",
3535
"@sentry/core": "8.45.0",
3636
"@sentry/node": "8.45.0",

dev-packages/node-integration-tests/suites/tracing/prisma-orm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"author": "",
1717
"license": "ISC",
1818
"dependencies": {
19-
"@prisma/client": "5.22.0",
20-
"prisma": "5.22.0"
19+
"@prisma/client": "6.2.1",
20+
"prisma": "6.2.1"
2121
}
2222
}

dev-packages/node-integration-tests/suites/tracing/prisma-orm/prisma/schema.prisma

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ datasource db {
55

66
generator client {
77
provider = "prisma-client-js"
8-
previewFeatures = ["tracing"]
98
}
109

1110
model User {

dev-packages/node-integration-tests/suites/tracing/prisma-orm/scenario.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ const { PrismaClient } = require('@prisma/client');
1616
setInterval(() => {}, 1000);
1717

1818
async function run() {
19-
const client = new PrismaClient();
20-
2119
await Sentry.startSpan(
2220
{
2321
name: 'Test Transaction',
2422
op: 'transaction',
2523
},
2624
async span => {
25+
const client = new PrismaClient();
26+
2727
await client.user.create({
2828
data: {
2929
name: 'Tilda',

dev-packages/node-integration-tests/suites/tracing/prisma-orm/test.ts

Lines changed: 64 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { SpanJSON } from '@sentry/core';
12
import { createRunner } from '../../../utils/runner';
23

34
describe('Prisma ORM Tests', () => {
@@ -10,127 +11,73 @@ describe('Prisma ORM Tests', () => {
1011
const spans = transaction.spans || [];
1112
expect(spans.length).toBeGreaterThanOrEqual(5);
1213

13-
expect(spans).toContainEqual(
14-
expect.objectContaining({
15-
data: {
16-
method: 'create',
17-
model: 'User',
18-
name: 'User.create',
19-
'sentry.origin': 'auto.db.otel.prisma',
20-
},
21-
description: 'prisma:client:operation',
22-
status: 'ok',
23-
}),
24-
);
14+
function expectPrismaSpanToIncludeSpanWith(span: Partial<SpanJSON>) {
15+
expect(spans).toContainEqual(
16+
expect.objectContaining({
17+
...span,
18+
data: {
19+
...span.data,
20+
'sentry.origin': 'auto.db.otel.prisma',
21+
},
22+
status: 'ok',
23+
}),
24+
);
25+
}
2526

26-
expect(spans).toContainEqual(
27-
expect.objectContaining({
28-
data: {
29-
'sentry.origin': 'auto.db.otel.prisma',
30-
},
31-
description: 'prisma:client:serialize',
32-
status: 'ok',
33-
}),
34-
);
27+
expectPrismaSpanToIncludeSpanWith({
28+
description: 'prisma:client:detect_platform',
29+
});
3530

36-
expect(spans).toContainEqual(
37-
expect.objectContaining({
38-
data: {
39-
'sentry.origin': 'auto.db.otel.prisma',
40-
},
41-
description: 'prisma:client:connect',
42-
status: 'ok',
43-
}),
44-
);
31+
expectPrismaSpanToIncludeSpanWith({
32+
description: 'prisma:client:load_engine',
33+
});
4534

46-
expect(spans).toContainEqual(
47-
expect.objectContaining({
48-
data: {
49-
'sentry.origin': 'auto.db.otel.prisma',
50-
},
51-
description: 'prisma:engine',
52-
status: 'ok',
53-
}),
54-
);
55-
expect(spans).toContainEqual(
56-
expect.objectContaining({
57-
data: {
58-
'sentry.origin': 'auto.db.otel.prisma',
59-
'sentry.op': 'db',
60-
'db.system': 'postgresql',
61-
},
62-
description: 'prisma:engine:connection',
63-
status: 'ok',
64-
op: 'db',
65-
}),
66-
);
35+
expectPrismaSpanToIncludeSpanWith({
36+
description: 'prisma:client:operation',
37+
data: {
38+
method: 'create',
39+
model: 'User',
40+
name: 'User.create',
41+
},
42+
});
6743

68-
expect(spans).toContainEqual(
69-
expect.objectContaining({
70-
data: {
71-
'db.statement': expect.stringContaining(
72-
'INSERT INTO "public"."User" ("createdAt","email","name") VALUES ($1,$2,$3) RETURNING "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" /* traceparent',
73-
),
74-
'sentry.origin': 'auto.db.otel.prisma',
75-
'sentry.op': 'db',
76-
'db.system': 'postgresql',
77-
'otel.kind': 'CLIENT',
78-
},
79-
description: expect.stringContaining(
80-
'INSERT INTO "public"."User" ("createdAt","email","name") VALUES ($1,$2,$3) RETURNING "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" /* traceparent',
81-
),
82-
status: 'ok',
83-
op: 'db',
84-
}),
85-
);
86-
expect(spans).toContainEqual(
87-
expect.objectContaining({
88-
data: {
89-
'sentry.origin': 'auto.db.otel.prisma',
90-
},
91-
description: 'prisma:engine:serialize',
92-
status: 'ok',
93-
}),
94-
);
95-
expect(spans).toContainEqual(
96-
expect.objectContaining({
97-
data: {
98-
'sentry.origin': 'auto.db.otel.prisma',
99-
},
100-
description: 'prisma:engine:response_json_serialization',
101-
status: 'ok',
102-
}),
103-
);
104-
expect(spans).toContainEqual(
105-
expect.objectContaining({
106-
data: {
107-
method: 'findMany',
108-
model: 'User',
109-
name: 'User.findMany',
110-
'sentry.origin': 'auto.db.otel.prisma',
111-
},
112-
description: 'prisma:client:operation',
113-
status: 'ok',
114-
}),
115-
);
116-
expect(spans).toContainEqual(
117-
expect.objectContaining({
118-
data: {
119-
'sentry.origin': 'auto.db.otel.prisma',
120-
},
121-
description: 'prisma:client:serialize',
122-
status: 'ok',
123-
}),
124-
);
125-
expect(spans).toContainEqual(
126-
expect.objectContaining({
127-
data: {
128-
'sentry.origin': 'auto.db.otel.prisma',
129-
},
130-
description: 'prisma:engine',
131-
status: 'ok',
132-
}),
133-
);
44+
expectPrismaSpanToIncludeSpanWith({
45+
description: 'prisma:client:serialize',
46+
});
47+
48+
expectPrismaSpanToIncludeSpanWith({
49+
description: 'prisma:client:connect',
50+
});
51+
52+
expectPrismaSpanToIncludeSpanWith({
53+
description: 'prisma:engine:connect',
54+
});
55+
56+
expectPrismaSpanToIncludeSpanWith({
57+
description: 'prisma:engine:query',
58+
});
59+
60+
expectPrismaSpanToIncludeSpanWith({
61+
data: {
62+
'sentry.op': 'db',
63+
'db.query.text':
64+
'SELECT "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1',
65+
'db.system': 'postgresql',
66+
'otel.kind': 'CLIENT',
67+
},
68+
description:
69+
'SELECT "public"."User"."id", "public"."User"."createdAt", "public"."User"."email", "public"."User"."name" FROM "public"."User" WHERE 1=1 OFFSET $1',
70+
});
71+
72+
expectPrismaSpanToIncludeSpanWith({
73+
data: {
74+
'sentry.op': 'db',
75+
'db.query.text': 'DELETE FROM "public"."User" WHERE "public"."User"."email"::text LIKE $1',
76+
'db.system': 'postgresql',
77+
'otel.kind': 'CLIENT',
78+
},
79+
description: 'DELETE FROM "public"."User" WHERE "public"."User"."email"::text LIKE $1',
80+
});
13481
},
13582
})
13683
.start(done);

dev-packages/node-integration-tests/suites/tracing/prisma-orm/yarn.lock

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,57 @@
22
# yarn lockfile v1
33

44

5-
"@prisma/client@5.22.0":
6-
version "5.22.0"
7-
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.22.0.tgz#da1ca9c133fbefe89e0da781c75e1c59da5f8802"
8-
integrity sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==
9-
10-
"@prisma/debug@5.22.0":
11-
version "5.22.0"
12-
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.22.0.tgz#58af56ed7f6f313df9fb1042b6224d3174bbf412"
13-
integrity sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==
14-
15-
"@prisma/engines-version@5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2":
16-
version "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2"
17-
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz#d534dd7235c1ba5a23bacd5b92cc0ca3894c28f4"
18-
integrity sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==
19-
20-
"@prisma/engines@5.22.0":
21-
version "5.22.0"
22-
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.22.0.tgz#28f3f52a2812c990a8b66eb93a0987816a5b6d84"
23-
integrity sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==
5+
"@prisma/client@6.2.1":
6+
version "6.2.1"
7+
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-6.2.1.tgz#3d7d0c8669bba490247e1ffff67b93a516bd789f"
8+
integrity sha512-msKY2iRLISN8t5X0Tj7hU0UWet1u0KuxSPHWuf3IRkB4J95mCvGpyQBfQ6ufcmvKNOMQSq90O2iUmJEN2e5fiA==
9+
10+
"@prisma/debug@6.2.1":
11+
version "6.2.1"
12+
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-6.2.1.tgz#887719967c4942d125262e48f6c47c45d17c1f61"
13+
integrity sha512-0KItvt39CmQxWkEw6oW+RQMD6RZ43SJWgEUnzxN8VC9ixMysa7MzZCZf22LCK5DSooiLNf8vM3LHZm/I/Ni7bQ==
14+
15+
"@prisma/engines-version@6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69":
16+
version "6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69"
17+
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69.tgz#b84ce3fab44bfa13a22669da02752330b61745b2"
18+
integrity sha512-7tw1qs/9GWSX6qbZs4He09TOTg1ff3gYsB3ubaVNN0Pp1zLm9NC5C5MZShtkz7TyQjx7blhpknB7HwEhlG+PrQ==
19+
20+
"@prisma/engines@6.2.1":
21+
version "6.2.1"
22+
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-6.2.1.tgz#14ef56bb780f02871a728667161d997a14aedb69"
23+
integrity sha512-lTBNLJBCxVT9iP5I7Mn6GlwqAxTpS5qMERrhebkUhtXpGVkBNd/jHnNJBZQW4kGDCKaQg/r2vlJYkzOHnAb7ZQ==
2424
dependencies:
25-
"@prisma/debug" "5.22.0"
26-
"@prisma/engines-version" "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2"
27-
"@prisma/fetch-engine" "5.22.0"
28-
"@prisma/get-platform" "5.22.0"
29-
30-
"@prisma/fetch-engine@5.22.0":
31-
version "5.22.0"
32-
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz#4fb691b483a450c5548aac2f837b267dd50ef52e"
33-
integrity sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==
25+
"@prisma/debug" "6.2.1"
26+
"@prisma/engines-version" "6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69"
27+
"@prisma/fetch-engine" "6.2.1"
28+
"@prisma/get-platform" "6.2.1"
29+
30+
"@prisma/fetch-engine@6.2.1":
31+
version "6.2.1"
32+
resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-6.2.1.tgz#cd7eb7428a407105e0f3761dba536aefd41fc7f7"
33+
integrity sha512-OO7O9d6Mrx2F9i+Gu1LW+DGXXyUFkP7OE5aj9iBfA/2jjDXEJjqa9X0ZmM9NZNo8Uo7ql6zKm6yjDcbAcRrw1A==
3434
dependencies:
35-
"@prisma/debug" "5.22.0"
36-
"@prisma/engines-version" "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2"
37-
"@prisma/get-platform" "5.22.0"
38-
39-
"@prisma/get-platform@5.22.0":
40-
version "5.22.0"
41-
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.22.0.tgz#fc675bc9d12614ca2dade0506c9c4a77e7dddacd"
42-
integrity sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==
35+
"@prisma/debug" "6.2.1"
36+
"@prisma/engines-version" "6.2.0-14.4123509d24aa4dede1e864b46351bf2790323b69"
37+
"@prisma/get-platform" "6.2.1"
38+
39+
"@prisma/get-platform@6.2.1":
40+
version "6.2.1"
41+
resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-6.2.1.tgz#34313cd0ee3587798ad33a7b57b6342dc8e66426"
42+
integrity sha512-zp53yvroPl5m5/gXYLz7tGCNG33bhG+JYCm74ohxOq1pPnrL47VQYFfF3RbTZ7TzGWCrR3EtoiYMywUBw7UK6Q==
4343
dependencies:
44-
"@prisma/debug" "5.22.0"
44+
"@prisma/debug" "6.2.1"
4545

4646
4747
version "2.3.3"
4848
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
4949
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
5050

51-
prisma@5.22.0:
52-
version "5.22.0"
53-
resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.22.0.tgz#1f6717ff487cdef5f5799cc1010459920e2e6197"
54-
integrity sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==
51+
prisma@6.2.1:
52+
version "6.2.1"
53+
resolved "https://registry.yarnpkg.com/prisma/-/prisma-6.2.1.tgz#457b210326d66d0e6f583cc6f9cd2819b984408f"
54+
integrity sha512-hhyM0H13pQleQ+br4CkzGizS5I0oInoeTw3JfLw1BRZduBSQxPILlJLwi+46wZzj9Je7ndyQEMGw/n5cN2fknA==
5555
dependencies:
56-
"@prisma/engines" "5.22.0"
56+
"@prisma/engines" "6.2.1"
5757
optionalDependencies:
5858
fsevents "2.3.3"

docs/migration/v8-to-v9.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ If you need to support older browsers, we recommend transpiling your code using
4040

4141
**Deno:** The minimum supported Deno version is now **2.0.0**.
4242

43-
### Framework Support Changes
43+
### Framework and Library Support Changes
4444

45-
Support for the following Framework versions is dropped:
45+
Support for the following frameworks and library versions are dropped:
4646

4747
- **Remix**: Version `1.x`
4848
- **TanStack Router**: Version `1.63.0` and lower (relevant when using `tanstackRouterBrowserTracingIntegration`)
49-
- **SvelteKit**: SvelteKit version `1.x`
50-
- **Ember.js**: Ember.js version `3.x` and lower (minimum supported version is `4.x`)
49+
- **SvelteKit**: Version `1.x`
50+
- **Ember.js**: Version `3.x` and lower (minimum supported version is `4.x`)
51+
- **Prisma**: Version `5.x`
5152

5253
### TypeScript Version Policy
5354

@@ -106,6 +107,13 @@ Older Typescript versions _may_ still work, but we will not test them anymore an
106107

107108
- The `childProcessIntegration`'s (previously `processThreadBreadcrumbIntegration`) `name` value has been changed from `"ProcessAndThreadBreadcrumbs"` to `"ChildProcess"`. This is relevant if you were filtering integrations by name.
108109

110+
- The Prisma integration no longer supports Prisma v5. As per Prisma v6, the `previewFeatures = ["tracing"]` client generator option in your Prisma Schema is no longer required to use tracing with the Prisma integration.
111+
112+
For performance instrumentation using Prisma v5:
113+
114+
1. Install the `@prisma/instrumentation` package on version 5
115+
1. Pass a `new PrismaInstrumentation()` instance as exported from `@prisma/instrumentation` to the the `Sentry.init()`'s `openTelemetryInstrumentations` option.
116+
109117
### `@sentry/browser`
110118

111119
- The SDK no longer instructs the Sentry backend to automatically infer IP addresses by default. This means that places where you previously saw IP addresses in Sentry may now be grouped to anonymous users. Set the `sendDefaultPii` option in `Sentry.init()` to true to instruct the Sentry backend to infer IP addresses.

0 commit comments

Comments
 (0)