From a7676be92f63e52a8e9dfeca2bc54f8b6cb3c7b0 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 09:45:32 +0200 Subject: [PATCH 1/5] rm some stuff --- .../javascript/guides/nextjs/manual-setup.mdx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx index fef4e39593acb..c3e4e3973c3da 100644 --- a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx +++ b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx @@ -189,9 +189,7 @@ Sentry.init({ ``` - Include your [Data Source Name](/concepts/key-terms/dsn-explainer/) (DSN) - directly in these files, or use a _public_ environment variable like - `NEXT_PUBLIC_SENTRY_DSN`. + Include your DSN directly in these files, or use a _public_ environment variable like `NEXT_PUBLIC_SENTRY_DSN`. ### Register Sentry Server-Side SDK Initialization @@ -210,12 +208,6 @@ export async function register() { } ``` - - You need to enable the instrumentation hook by setting the - `experimental.instrumentationHook` to `true` in your `next.config.(js|mjs)` - file. - - If you want the Sentry SDK to be available on the server side and not on the client side, simply delete `instrumentation-client.(js|ts)`. This will prevent From 03bfa7e2deb0a98d3ae6164aaac53ed842d6cddf Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 09:52:42 +0200 Subject: [PATCH 2/5] add note on client instrumentation --- .../javascript/guides/nextjs/manual-setup.mdx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx index c3e4e3973c3da..d1df89896ba83 100644 --- a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx +++ b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx @@ -87,7 +87,13 @@ export default withSentryConfig(nextConfig, { ### Initialize Sentry Client-Side and Server-Side SDKs -Create three files in your application's root directory: `sentry.server.config.(js|ts)`, `sentry.edge.config.(js|ts)`, and `instrumentation-client.(js|ts)`. Add the following initialization code into each respective file: +Create three files in your application's root directory: +- `sentry.server.config.(js|ts)` +- `sentry.edge.config.(js|ts)` +- `instrumentation-client.(js|ts)` + - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. + +Add the following initialization code into each respective file: These files run in different environments (browser, server, edge) and are @@ -112,8 +118,8 @@ Sentry.init({ // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate tracesSampleRate: 1.0, // ___PRODUCT_OPTION_END___ performance - // Replay may only be enabled for the client-side // ___PRODUCT_OPTION_START___ session-replay + // Replay may only be enabled for the client-side integrations: [Sentry.replayIntegration()], // Capture Replay for 10% of all sessions, @@ -188,7 +194,7 @@ Sentry.init({ }); ``` - + Include your DSN directly in these files, or use a _public_ environment variable like `NEXT_PUBLIC_SENTRY_DSN`. From c1d9a1b252b0b0db9f80aa69a6ec95d16581e2e3 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 09:59:48 +0200 Subject: [PATCH 3/5] update tracing page --- .../javascript.nextjs.mdx | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx index ef9209563348c..dca79e5f57e89 100644 --- a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx +++ b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx @@ -1,13 +1,45 @@ -Set `tracesSampleRate` in your config files, `instrumentation-client.js`, `sentry.server.config.js`, and `sentry.edge.config.js`: +Set `tracesSampleRate` in your config files: +- `sentry.server.config.js` +- `sentry.edge.config.js`: +- `instrumentation-client.js` + - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. -```javascript +```javascript {tabTitle:Client} {filename:instrumentation-client.(js|ts)} import * as Sentry from "@sentry/nextjs"; Sentry.init({ dsn: "___PUBLIC_DSN___", + // We recommend adjusting this value in production, or using `tracesSampler` + // for finer control + tracesSampleRate: 1.0, + // ... rest of your config +}); + +// This export will instrument router navigations, and is only relevant if you enable tracing. +// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards +export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; +``` + +```javascript {tabTitle:Server} {filename:sentry.server.config.(js|ts)} +import * as Sentry from "@sentry/nextjs"; +Sentry.init({ + dsn: "___PUBLIC_DSN___", // We recommend adjusting this value in production, or using `tracesSampler` // for finer control tracesSampleRate: 1.0, + // ... rest of your config }); ``` + +```javascript {tabTitle:Edge} {filename:sentry.edge.config.(js|ts)} +import * as Sentry from "@sentry/nextjs"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + // We recommend adjusting this value in production, or using `tracesSampler` + // for finer control + tracesSampleRate: 1.0, + // ... rest of your config +}); +``` \ No newline at end of file From 4349c4c6caa121f98046531f838456f652b63893 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 10:24:18 +0200 Subject: [PATCH 4/5] Update platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx Co-authored-by: Francesco Gringl-Novy --- .../performance/configure-sample-rate/javascript.nextjs.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx index dca79e5f57e89..c0a1484e608ff 100644 --- a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx +++ b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx @@ -2,7 +2,7 @@ Set `tracesSampleRate` in your config files: - `sentry.server.config.js` - `sentry.edge.config.js`: - `instrumentation-client.js` - - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. + - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. ```javascript {tabTitle:Client} {filename:instrumentation-client.(js|ts)} import * as Sentry from "@sentry/nextjs"; From 29b94da4182306414311fb0dd0bad01ca2b55b80 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Fri, 23 May 2025 10:24:27 +0200 Subject: [PATCH 5/5] Update docs/platforms/javascript/guides/nextjs/manual-setup.mdx Co-authored-by: Francesco Gringl-Novy --- docs/platforms/javascript/guides/nextjs/manual-setup.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx index d1df89896ba83..8606f00a8006a 100644 --- a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx +++ b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx @@ -91,7 +91,7 @@ Create three files in your application's root directory: - `sentry.server.config.(js|ts)` - `sentry.edge.config.(js|ts)` - `instrumentation-client.(js|ts)` - - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. + - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. Add the following initialization code into each respective file: