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
Exclude specific server-side API routes or pages from automatic Sentry instrumentation during build time.
187
+
This option takes an array of strings or regular expressions and affects pages in the `pages` and `app` directories.
188
+
189
+
When defining routes, note the following:
190
+
191
+
- Specify pages as routes and not as file system paths. For example, write `/animals` instead of `pages/animals/index.js`.
192
+
- Make sure that any provided string matches the route exactly, has a leading slash, and doesn't have a trailing slash.
193
+
194
+
```javascript
195
+
excludeServerRoutes: [
196
+
"/some/excluded/route",
197
+
"/excluded/route/with/[parameter]",
198
+
/^\/route\/beginning\/with\/some\/prefix/,
199
+
/\/routeContainingASpecificPathSegment\/?/,
200
+
];
201
+
```
202
+
203
+
<Alertlevel="info">
204
+
If you're building your Next.js application with Turbopack, this option will
205
+
have no effect. The Sentry SDK will no longer apply build-time instrumentation
206
+
and will rely purely on Next.js telemetry features.
207
+
</Alert>
208
+
209
+
</SdkOption>
210
+
185
211
<SdkOptionname="tunnelRoute"type="string">
212
+
<Alertlevel="info">
213
+
This feature requires **Next.js version 11+** and doesn't currently work with self-hosted Sentry instances.
214
+
</Alert>
215
+
216
+
Tunnel Sentry requests through this route on your Next.js server to prevent ad-blockers from blocking Sentry events from being sent.
217
+
This route should be a path, like `/error-monitoring`, as it adds an API endpoint within your application.
186
218
187
-
Tunnel Sentry requests through this route on the Next.js server, to circumvent ad-blockers blocking Sentry events from being sent. This option should be a path (for example: '/error-monitoring').
219
+
Learn more about tunneling in the <PlatformLinkto="/troubleshooting/#dealing-with-ad-blockers">troubleshooting section</PlatformLink>.
188
220
189
-
Note: This feature only works with Next.js 11+
221
+
<Expandablelevel="warning"title="Complications with Next.js middleware">
222
+
Client-side event recording will fail if your Next.js middleware intercepts
223
+
the configured route. To prevent this, exclude the tunnel route by adding a
224
+
negative matcher to your middleware like `(?!monitoring-tunnel)`.
225
+
</Expandable>
190
226
191
227
</SdkOption>
192
228
@@ -195,3 +231,18 @@ Note: This feature only works with Next.js 11+
195
231
Automatically create cron monitors in Sentry for your Vercel Cron Jobs if configured via `vercel.json`.
196
232
197
233
</SdkOption>
234
+
235
+
<SdkOption
236
+
name="unstable_sentryWebpackPluginOptions"
237
+
type="SentryWebpackPluginOptions"
238
+
>
239
+
Pass configuration options directly to the [Sentry Webpack
240
+
Plugin](https://www.npmjs.com/package/@sentry/webpack-plugin) that ships with
241
+
the Sentry Next.js SDK. If `withSentryConfig` doesn't provide the option you
242
+
need to modify, you may override the `sentryWebpackPluginOptions` using this
243
+
option.
244
+
<Alertlevel="warning"title="Important">
245
+
This option is considered unstable, and its API may change in a breaking way
0 commit comments