forked from FlowwStar/FlowStar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsentry.client.config.ts
More file actions
32 lines (28 loc) · 928 Bytes
/
Copy pathsentry.client.config.ts
File metadata and controls
32 lines (28 loc) · 928 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
29
30
31
32
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Only active in production — avoids noise during development.
enabled: process.env.NODE_ENV === "production",
// Capture 10% of transactions for performance monitoring.
tracesSampleRate: 0.1,
// Scrub sensitive data before it leaves the browser.
beforeSend(event) {
if (event.request?.data) {
// Never log raw transaction payloads.
event.request.data = "[REDACTED]";
}
// Truncate any full Stellar addresses in breadcrumbs to the first 8 chars.
if (event.breadcrumbs) {
event.breadcrumbs = event.breadcrumbs.map((b) => {
if (typeof b.message === "string") {
b.message = b.message.replace(
/\b(G[A-Z2-7]{55})\b/g,
(addr) => `${addr.slice(0, 8)}…`,
);
}
return b;
});
}
return event;
},
});