diff --git a/next.config.js b/next.config.js index 49f9d84fe..bbb806da8 100644 --- a/next.config.js +++ b/next.config.js @@ -48,6 +48,11 @@ module.exports = withSentryConfig(withBundleAnalyzer(nextConfig), { // Upload a larger set of source maps for prettier stack traces (increases build time) widenClientFileUpload: true, + // Automatically annotate React components to show their full name in breadcrumbs and session replay + reactComponentAnnotation: { + enabled: true, + }, + // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. // This can increase your server load as well as your hosting bill. // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client- diff --git a/sentry.client.config.ts b/sentry.client.config.ts index e60fdecab..23df738f7 100644 --- a/sentry.client.config.ts +++ b/sentry.client.config.ts @@ -12,19 +12,19 @@ Sentry.init({ tracesSampleRate: 1, // Setting this option to true will print useful information to the console while you're setting up Sentry. - debug: false, - replaysOnErrorSampleRate: 1.0, + debug: true, + // replaysOnErrorSampleRate: 1.0, // This sets the sample rate to be 10%. You may want this to be 100% while // in development and sample at a lower rate in production - replaysSessionSampleRate: 0.1, + // replaysSessionSampleRate: 0.1, // You can remove this option if you're not planning to use the Sentry Session Replay feature: - integrations: [ - Sentry.replayIntegration({ - // Additional Replay configuration goes in here, for example: - maskAllText: true, - blockAllMedia: true, - }), - ], + // integrations: [ + // Sentry.replayIntegration({ + // // Additional Replay configuration goes in here, for example: + // maskAllText: true, + // blockAllMedia: true, + // }), + // ], }); diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts new file mode 100644 index 000000000..e0f2269e8 --- /dev/null +++ b/sentry.edge.config.ts @@ -0,0 +1,15 @@ +// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on). +// The config you add here will be used whenever one of the edge features is loaded. +// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ +import * as Sentry from '@sentry/nextjs'; + +Sentry.init({ + dsn: 'https://e1dce4791416146de03ff1642ed719d5@o204651.ingest.us.sentry.io/4507788896239616', + + // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. + tracesSampleRate: 1, + + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, +}); diff --git a/sentry.server.config.ts b/sentry.server.config.ts new file mode 100644 index 000000000..c92409825 --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,14 @@ +// This file configures the initialization of Sentry on the server. +// The config you add here will be used whenever the server handles a request. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ +import * as Sentry from '@sentry/nextjs'; + +Sentry.init({ + dsn: 'https://e1dce4791416146de03ff1642ed719d5@o204651.ingest.us.sentry.io/4507788896239616', + + // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control. + tracesSampleRate: 1, + + // Setting this option to true will print useful information to the console while you're setting up Sentry. + debug: false, +}); diff --git a/src/app/api/sentry-example-api/route.ts b/src/app/api/sentry-example-api/route.ts new file mode 100644 index 000000000..abf82362e --- /dev/null +++ b/src/app/api/sentry-example-api/route.ts @@ -0,0 +1,9 @@ +import { NextResponse } from 'next/server'; + +export const dynamic = 'force-dynamic'; + +// A faulty API route to test Sentry's error monitoring +export function GET() { + throw new Error('Sentry Example API Route Error'); + return NextResponse.json({ data: 'Testing Sentry Error...' }); +} diff --git a/src/app/sentry-example-page/page.tsx b/src/app/sentry-example-page/page.tsx new file mode 100644 index 000000000..d74aa0583 --- /dev/null +++ b/src/app/sentry-example-page/page.tsx @@ -0,0 +1,82 @@ +'use client'; + +import * as Sentry from '@sentry/nextjs'; +import Head from 'next/head'; + +export default function Page() { + return ( +
+ + Sentry Onboarding + + + +
+

+ + + +

+ +

Get started by sending us a sample error:

+ + +

+ Next, look for the error on the{' '} + Issues Page. +

+

+ For more information, see{' '} + + https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +

+
+
+ ); +}