File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,25 +7,19 @@ import * as Sentry from "@sentry/nextjs";
77Sentry . init ( {
88 dsn : "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968" ,
99
10- // Add optional integrations for additional features
1110 integrations : [ Sentry . replayIntegration ( ) ] ,
1211
13- // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
14- tracesSampleRate : 1 ,
15- // Enable logs to be sent to Sentry
12+ environment : process . env . NODE_ENV ,
13+
14+ tracesSampleRate : process . env . NODE_ENV === "production" ? 0.1 : 1 ,
15+
1616 enableLogs : true ,
1717
18- // Define how likely Replay events are sampled.
19- // This sets the sample rate to be 10%. You may want this to be 100% while
20- // in development and sample at a lower rate in production
2118 replaysSessionSampleRate : 0.1 ,
2219
23- // Define how likely Replay events are sampled when an error occurs.
2420 replaysOnErrorSampleRate : 1.0 ,
2521
26- // Enable sending user PII (Personally Identifiable Information)
27- // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
28- sendDefaultPii : true ,
22+ sendDefaultPii : false ,
2923} ) ;
3024
3125export const onRouterTransitionStart = Sentry . captureRouterTransitionStart ;
Original file line number Diff line number Diff line change @@ -36,17 +36,13 @@ const nextConfig: NextConfig = {
3636} ;
3737
3838export default withSentryConfig ( nextConfig , {
39- // For all available options, see:
40- // https://www.npmjs.com/package/@sentry /webpack-plugin#options
4139 org : "100kode" ,
4240 project : "vibe-coding-profiler" ,
41+ authToken : process . env . SENTRY_AUTH_TOKEN ,
4342
44- // Only print logs for uploading source maps in CI
4543 silent : ! process . env . CI ,
4644
47- // Upload a larger set of source maps for prettier stack traces (increases build time)
4845 widenClientFileUpload : true ,
4946
50- // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
5147 tunnelRoute : "/monitoring" ,
5248} ) ;
Original file line number Diff line number Diff line change @@ -8,13 +8,11 @@ import * as Sentry from "@sentry/nextjs";
88Sentry . init ( {
99 dsn : "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968" ,
1010
11- // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
12- tracesSampleRate : 1 ,
11+ environment : process . env . VERCEL_ENV ?? process . env . NODE_ENV ,
12+
13+ tracesSampleRate : process . env . NODE_ENV === "production" ? 0.1 : 1 ,
1314
14- // Enable logs to be sent to Sentry
1515 enableLogs : true ,
1616
17- // Enable sending user PII (Personally Identifiable Information)
18- // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
19- sendDefaultPii : true ,
17+ sendDefaultPii : false ,
2018} ) ;
Original file line number Diff line number Diff line change @@ -7,13 +7,11 @@ import * as Sentry from "@sentry/nextjs";
77Sentry . init ( {
88 dsn : "https://0ddc11d7b3f42d5ca32ecf0b74ff61ef@o4510870266118144.ingest.us.sentry.io/4510870274899968" ,
99
10- // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
11- tracesSampleRate : 1 ,
10+ environment : process . env . VERCEL_ENV ?? process . env . NODE_ENV ,
11+
12+ tracesSampleRate : process . env . NODE_ENV === "production" ? 0.1 : 1 ,
1213
13- // Enable logs to be sent to Sentry
1414 enableLogs : true ,
1515
16- // Enable sending user PII (Personally Identifiable Information)
17- // https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
18- sendDefaultPii : true ,
16+ sendDefaultPii : false ,
1917} ) ;
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 >
18+ < body >
19+ < NextError statusCode = { 0 } />
20+ </ body >
21+ </ html >
22+ ) ;
23+ }
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from "vitest" ;
2+
3+ import { config } from "@/proxy" ;
4+
5+ describe ( "Sentry routing" , ( ) => {
6+ it ( "excludes the Sentry tunnel from the auth proxy" , ( ) => {
7+ expect ( config . matcher ) . toEqual ( [
8+ "/((?!monitoring|_next/static|_next/image|favicon.ico).*)" ,
9+ ] ) ;
10+ } ) ;
11+ } ) ;
Original file line number Diff line number Diff line change @@ -74,5 +74,5 @@ export async function proxy(request: NextRequest) {
7474}
7575
7676export const config = {
77- matcher : [ "/((?!_next/static|_next/image|favicon.ico).*)" ] ,
77+ matcher : [ "/((?!monitoring| _next/static|_next/image|favicon.ico).*)" ] ,
7878} ;
You can’t perform that action at this time.
0 commit comments