Skip to content

Commit 3470838

Browse files
authored
docs(js): Update Next.js instrumentation instructions (#12532)
1 parent 4469aa5 commit 3470838

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/platforms/javascript/guides/nextjs/manual-setup.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ We recommend you include your DSN directly in these three files. Alternatively y
156156

157157
While the client initialization code will be injected into your application's client bundle by `withSentryConfig` which we set up earlier,
158158
the configuration for the server and edge runtime needs to be imported from a [Next.js Instrumentation file](https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation).
159-
To set up this file, enable the Next.js instrumentation hook by setting the [`experimental.instrumentationHook`](https://nextjs.org/docs/app/api-reference/next-config-js/instrumentationHook) to `true` in your `next.config.js`.
160-
Then add a `instrumentation.ts` file to the root directory of your Next.js application (or inside the `src` folder if you're using one) and add the following content:
159+
160+
<Alert>
161+
For Next.js versions `<15` enable the Next.js instrumentation hook by setting the [`experimental.instrumentationHook`](https://nextjs.org/docs/14/pages/api-reference/next-config-js/instrumentationHook) to `true` in your `next.config.js`.
162+
</Alert>
163+
164+
Add a `instrumentation.ts` file to the root directory of your Next.js application (or inside the `src` folder if you're using one) and add the following content:
161165

162166
```javascript {filename:instrumentation.(js|ts)}
163167
export async function register() {
@@ -171,6 +175,7 @@ export async function register() {
171175
}
172176
```
173177

178+
174179
Make sure that the `import` statements point to your newly created `sentry.server.config.(js|ts)` and `sentry.edge.config.(js|ts)` files.
175180

176181
## Report React Component Render Errors

0 commit comments

Comments
 (0)