File tree Expand file tree Collapse file tree 11 files changed +1695
-51
lines changed Expand file tree Collapse file tree 11 files changed +1695
-51
lines changed Original file line number Diff line number Diff line change @@ -41,3 +41,8 @@ UPLOAD_ACCESS_KEY_ID="captable"
41
41
UPLOAD_SECRET_ACCESS_KEY = " password"
42
42
UPLOAD_BUCKET_PUBLIC = " captable-public-bucket"
43
43
UPLOAD_BUCKET_PRIVATE = " captable-private-bucket"
44
+
45
+ # Sentry
46
+ SENTRY_ORG = YOUR_SENTRY_ORG
47
+ SENTRY_PROJECT = YOUR_SENTRY_PROJECT
48
+ NEXT_PUBLIC_SENTRY_DSN = YOUR_SENTRY_DSN
Original file line number Diff line number Diff line change @@ -54,3 +54,6 @@ yarn-error.log*
54
54
/prisma /enums.ts
55
55
56
56
/.pnpm-store
57
+
58
+ # Sentry Config File
59
+ .env.sentry-build-plugin
Original file line number Diff line number Diff line change 1
1
import withBundleAnalyzer from "@next/bundle-analyzer" ;
2
+ import { withSentryConfig } from "@sentry/nextjs" ;
2
3
3
4
const bundleAnalyzer = withBundleAnalyzer ( {
4
5
enabled : process . env . ANALYZE === "true" ,
@@ -11,7 +12,7 @@ const bundleAnalyzer = withBundleAnalyzer({
11
12
await import ( "./src/env.js" ) ;
12
13
13
14
/** @type {import("next").NextConfig } */
14
- const config = {
15
+ const nextConfig = {
15
16
output : process . env . DOCKER_OUTPUT ? "standalone" : undefined ,
16
17
images : {
17
18
remotePatterns : [
@@ -43,4 +44,18 @@ const config = {
43
44
} ,
44
45
} ;
45
46
46
- export default bundleAnalyzer ( config ) ;
47
+ const sentryOptions = {
48
+ org : process . env . SENTRY_ORG ,
49
+ project : process . env . SENTRY_PROJECT ,
50
+ silent : true ,
51
+ widenClientFileUpload : true ,
52
+ hideSourceMaps : true ,
53
+ disableLogger : true ,
54
+ automaticVercelMonitors : true ,
55
+ } ;
56
+
57
+ const hasSentry = ! ! process . env . NEXT_PUBLIC_SENTRY_DSN ;
58
+
59
+ export default hasSentry
60
+ ? withSentryConfig ( bundleAnalyzer ( nextConfig ) , sentryOptions )
61
+ : bundleAnalyzer ( nextConfig ) ;
Original file line number Diff line number Diff line change 55
55
"@radix-ui/react-toolbar" : " ^1.0.4" ,
56
56
"@react-pdf/renderer" : " ^3.4.4" ,
57
57
"@remixicon/react" : " ^4.0.1" ,
58
+ "@sentry/nextjs" : " ^8" ,
58
59
"@simplewebauthn/browser" : " ^10.0.0" ,
59
60
"@simplewebauthn/server" : " ^10.0.0" ,
60
61
"@sindresorhus/slugify" : " ^2.2.1" ,
Original file line number Diff line number Diff line change
1
+ import * as Sentry from "@sentry/nextjs" ;
2
+
3
+ Sentry . init ( {
4
+ dsn : process . env . NEXT_PUBLIC_SENTRY_DSN ,
5
+ tracesSampleRate : 1 ,
6
+ debug : false ,
7
+ replaysOnErrorSampleRate : 1.0 ,
8
+ replaysSessionSampleRate : 0.1 ,
9
+ integrations : [
10
+ Sentry . replayIntegration ( {
11
+ maskAllText : true ,
12
+ blockAllMedia : true ,
13
+ } ) ,
14
+ ] ,
15
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import * as Sentry from "@sentry/nextjs" ;
2
+
3
+ Sentry . init ( {
4
+ dsn : process . env . NEXT_PUBLIC_SENTRY_DSN ,
5
+ tracesSampleRate : 1 ,
6
+ debug : false ,
7
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import * as Sentry from "@sentry/nextjs" ;
2
+
3
+ Sentry . init ( {
4
+ dsn : process . env . NEXT_PUBLIC_SENTRY_DSN ,
5
+ tracesSampleRate : 1 ,
6
+ debug : false ,
7
+ } ) ;
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import * as Sentry from "@sentry/nextjs" ;
4
+ import NextError from "next/error" ;
5
+ import { useEffect } from "react" ;
6
+
7
+ export default function GlobalError ( {
8
+ error,
9
+ } : {
10
+ error : Error & { digest ?: string } ;
11
+ } ) {
12
+ useEffect ( ( ) => {
13
+ Sentry . captureException ( error ) ;
14
+ } , [ error ] ) ;
15
+
16
+ return (
17
+ < html lang = "en" >
18
+ < body >
19
+ < NextError statusCode = { undefined as never } />
20
+ </ body >
21
+ </ html >
22
+ ) ;
23
+ }
Original file line number Diff line number Diff line change @@ -52,6 +52,10 @@ export const env = createEnv({
52
52
// stripe
53
53
STRIPE_API_KEY : z . string ( ) . optional ( ) ,
54
54
STRIPE_WEBHOOK_SECRET : z . string ( ) . optional ( ) ,
55
+
56
+ // sentry
57
+ SENTRY_ORG : z . string ( ) . optional ( ) ,
58
+ SENTRY_PROJECT : z . string ( ) . optional ( ) ,
55
59
} ,
56
60
57
61
/**
@@ -63,6 +67,7 @@ export const env = createEnv({
63
67
NEXT_PUBLIC_BASE_URL : z . string ( ) ,
64
68
NEXT_PUBLIC_UPLOAD_DOMAIN : z . string ( ) . optional ( ) ,
65
69
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY : z . string ( ) . optional ( ) ,
70
+ NEXT_PUBLIC_SENTRY_DSN : z . string ( ) . optional ( ) ,
66
71
} ,
67
72
68
73
/**
Original file line number Diff line number Diff line change @@ -2,5 +2,11 @@ export async function register() {
2
2
if ( process . env . NEXT_RUNTIME === "nodejs" ) {
3
3
const { startJobs } = await import ( "@/jobs/start" ) ;
4
4
await startJobs ( ) ;
5
+
6
+ await import ( "../sentry.server.config" ) ;
7
+ }
8
+
9
+ if ( process . env . NEXT_RUNTIME === "edge" ) {
10
+ await import ( "../sentry.edge.config" ) ;
5
11
}
6
12
}
You can’t perform that action at this time.
0 commit comments