-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstrumentation.ts
More file actions
28 lines (28 loc) · 871 Bytes
/
Copy pathinstrumentation.ts
File metadata and controls
28 lines (28 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as Sentry from "@sentry/nextjs";
import { DrizzleQueryError } from "drizzle-orm";
export async function register() {
Sentry.init({
enabled: process.env.NODE_ENV !== "development",
dsn: process.env.SENTRY_DSN,
integrations: [
Sentry.extraErrorDataIntegration({ depth: 10 }),
Sentry.zodErrorsIntegration(),
],
beforeSend: function (event, hint) {
if (
hint.originalException instanceof DrizzleQueryError &&
hint.originalException.cause
) {
event.fingerprint = [
String(hint.originalException.cause),
event.transaction ?? "",
];
}
return event;
},
// Adds request headers and IP for users
sendDefaultPii: true,
});
}
// Capture errors from Server Components, middleware, and proxies
export const onRequestError = Sentry.captureRequestError;