You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/platforms/javascript/guides/nextjs/manual-setup.mdx
+27-13Lines changed: 27 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ If you can't (or prefer not to) run the [configuration step](/platforms/javascri
8
8
9
9
## Create Initialization Config Files
10
10
11
-
Create two files in the root directory of your project, `sentry.client.config.js`and `sentry.server.config.js`. In these files, add your initialization code for the client-side SDK and server-side SDK, respectively. We've included some examples below.
11
+
Create three files in the root directory of your project, `sentry.client.config.js`, `sentry.server.config.js`and `sentry.edge.config.js`. In these files, add your initialization code for the client-side SDK and server-side SDK, respectively. We've included some examples below.
The SDK will automatically instrument API routes and server-side [Next.js data fetching methods](https://nextjs.org/docs/basic-features/data-fetching/overview) with error and performance monitoring.
321
321
322
-
### Disable API Route and Data Fetching Auto-instrumentation Entirely
322
+
### Disable API Route, Middleware and Data Fetching Auto-instrumentation Entirely
323
323
324
324
_(New in version 7.14.0)_
325
325
@@ -341,7 +341,7 @@ _(New in version 7.14.0)_
341
341
342
342
If the automatic instrumentation doesn't work for your use case, you can turn it off globally and choose to only wrap specific API route handlers or data fetching functions instead.
343
343
344
-
For API routes, use the `withSentry` function:
344
+
For API routes, use the `wrapApiHandlerWithSentry` function:
For data fetching methods, use the following functions:
368
368
369
-
-`withSentryServerSideGetInitialProps` for `getInitialProps`
370
-
-`withSentryGetServerSideProps` for `getServerSideProps`
371
-
-`withSentryGetStaticProps` for `getStaticProps`
372
-
-`withSentryServerSideErrorGetInitialProps` for `getInitialProps` in [custom Error pages](https://nextjs.org/docs/advanced-features/custom-error-page)
373
-
-`withSentryServerSideAppGetInitialProps` for `getInitialProps` in [custom `App` components](https://nextjs.org/docs/advanced-features/custom-app)
374
-
-`withSentryServerSideDocumentGetInitialProps` for `getInitialProps` in [custom `Document` components](https://nextjs.org/docs/advanced-features/custom-document)
369
+
-`wrapGetInitialPropsWithSentry` for `getInitialProps`
370
+
-`wrapGetServerSidePropsWithSentry` for `getServerSideProps`
371
+
-`wrapGetStaticPropsWithSentry` for `getStaticProps`
372
+
-`wrapErrorGetInitialPropsWithSentry` for `getInitialProps` in [custom Error pages](https://nextjs.org/docs/advanced-features/custom-error-page)
373
+
-`wrapAppGetInitialPropsWithSentry` for `getInitialProps` in [custom `App` components](https://nextjs.org/docs/advanced-features/custom-app)
374
+
-`wrapDocumentGetInitialPropsWithSentry` for `getInitialProps` in [custom `Document` components](https://nextjs.org/docs/advanced-features/custom-document)
375
375
376
376
### Opt Out of Auto-instrumentation on Specific Routes
377
377
@@ -394,6 +394,20 @@ const moduleExports = {
394
394
395
395
Excluded routes can be specified either as regexes or strings. When using a string, make sure that it matches the route exactly, and has a leading slash but no trailing one.
396
396
397
+
### Opt Out of Auto-instrumentation on Middleware
398
+
399
+
_(New in version 7.31.0)_
400
+
401
+
To disable the automatic instrumentation of Next.js middleware, set the `autoInstrumentMiddleware` option to `false`.
0 commit comments