-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsentry.client.config.ts
More file actions
36 lines (27 loc) · 1.05 KB
/
sentry.client.config.ts
File metadata and controls
36 lines (27 loc) · 1.05 KB
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
33
34
35
36
// This file configures the initialization of Sentry on the client.
// The added config here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs'
console.log('Sentry Client Init:', {
dsn: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN ? 'SET' : 'NOT SET',
environment: process.env.NODE_ENV,
})
Sentry.init({
dsn: process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
environment: process.env.NODE_ENV,
// Protected Privacy
sendDefaultPii: false,
release: process.env.SENTRY_RELEASE || process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
beforeSend(event) {
if (process.env.NODE_ENV === 'development') {
console.error('Sentry Client Event:', event)
}
// Bot filtering
const userAgent = event.request?.headers?.['User-Agent'] || ''
if (/bot|crawler|spider/i.test(userAgent)) {
return null
}
return event
},
})