File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,4 +55,7 @@ next-env.d.ts
5555
5656# file uploads
5757uploads /
58- uploads /*
58+ uploads /*
59+
60+ # Sentry Config File
61+ .env.sentry-build-plugin
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 ( { error } : { error : Error & { digest ?: string } } ) {
8+ useEffect ( ( ) => {
9+ Sentry . captureException ( error ) ;
10+ } , [ error ] ) ;
11+
12+ return (
13+ < html >
14+ < body >
15+ { /* `NextError` is the default Next.js error page component. Its type
16+ definition requires a `statusCode` prop. However, since the App Router
17+ does not expose status codes for errors, we simply pass 0 to render a
18+ generic error message. */ }
19+ < NextError statusCode = { 0 } />
20+ </ body >
21+ </ html >
22+ ) ;
23+ }
Original file line number Diff line number Diff line change 66 *
77 */
88
9+ // This file configures the initialization of Sentry on the client.
10+ // The added config here will be used whenever a users loads a page in their browser.
11+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/
12+
13+ import * as Sentry from "@sentry/nextjs"
14+
15+ Sentry . init ( {
16+ dsn : process . env . NEXT_PUBLIC_SENTRY_DSN || undefined ,
17+ enabled : process . env . NODE_ENV === 'production' ,
18+ environment : process . env . NODE_ENV || 'development' ,
19+ integrations : [
20+ Sentry . replayIntegration ( ) ,
21+ ] ,
22+ tracesSampleRate : process . env . NODE_ENV === 'production' ? 0.2 : 1 ,
23+ replaysSessionSampleRate : process . env . NODE_ENV === 'production' ? 0.1 : 0 ,
24+ replaysOnErrorSampleRate : process . env . NODE_ENV === 'production' ? 1.0 : 0 ,
25+ debug : process . env . NODE_ENV === 'development' ,
26+ beforeSend ( event ) {
27+ if ( process . env . NODE_ENV !== 'production' ) return null
28+ if ( event . request && typeof event . request === 'object' ) {
29+ ( event . request as any ) . ip = null
30+ }
31+ return event
32+ } ,
33+ } )
34+
35+ export const onRouterTransitionStart = Sentry . captureRouterTransitionStart
36+
937if ( typeof window !== 'undefined' ) {
1038 const TELEMETRY_STATUS_KEY = 'simstudio-telemetry-status'
1139 let telemetryEnabled = true
Original file line number Diff line number Diff line change 1313// Set experimental.instrumentationHook = true in next.config.ts to enable this
1414
1515import { createLogger } from '@/lib/logs/console-logger'
16+ import * as Sentry from '@sentry/nextjs'
1617
1718const logger = createLogger ( 'otel-instrumentation' )
1819
@@ -30,6 +31,16 @@ const DEFAULT_TELEMETRY_CONFIG = {
3031}
3132
3233export async function register ( ) {
34+ // Sentry configuration
35+ if ( process . env . NEXT_RUNTIME === 'nodejs' ) {
36+ await import ( './sentry.server.config' )
37+ }
38+
39+ if ( process . env . NEXT_RUNTIME === 'edge' ) {
40+ await import ( './sentry.edge.config' )
41+ }
42+
43+ // OpenTelemetry instrumentation
3344 if ( process . env . NEXT_RUNTIME === 'nodejs' ) {
3445 try {
3546 if ( process . env . NEXT_TELEMETRY_DISABLED === '1' ) {
@@ -93,4 +104,6 @@ export async function register() {
93104 logger . error ( 'Failed to initialize OpenTelemetry instrumentation' , error )
94105 }
95106 }
96- }
107+ }
108+
109+ export const onRequestError = Sentry . captureRequestError
Original file line number Diff line number Diff line change 1+ import { withSentryConfig } from '@sentry/nextjs' ;
12import type { NextConfig } from 'next'
23
34const nextConfig : NextConfig = {
@@ -92,4 +93,12 @@ const nextConfig: NextConfig = {
9293 } ,
9394}
9495
95- export default nextConfig
96+ export default withSentryConfig ( nextConfig , {
97+ org : 'sim-studio' ,
98+ project : 'javascript-nextjs' ,
99+ silent : ! process . env . CI ,
100+ widenClientFileUpload : true ,
101+ tunnelRoute : "/monitoring" ,
102+ disableLogger : true ,
103+ automaticVercelMonitors : true ,
104+ } )
You can’t perform that action at this time.
0 commit comments