-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update Next.js Build Options with content from Manual Setup page #12852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chargome
merged 3 commits into
master
from
smi/nextjs/manual-setup-move-content-options
Feb 28, 2025
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -146,6 +146,21 @@ If set to `true`, the Sentry SDK will attempt to tree-shake code related to trac | |||||||
|
||||||||
## Next.js Specific Options | ||||||||
|
||||||||
<SdkOption | ||||||||
name="unstable_sentryWebpackPluginOptions" | ||||||||
type="SentryWebpackPluginOptions" | ||||||||
> | ||||||||
Pass configuration options directly to the Sentry Webpack Plugin | ||||||||
[`@sentry/webpack-plugin`](https://www.npmjs.com/package/@sentry/webpack-plugin) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
that ships with the Sentry Next.js SDK. If `withSentryConfig` doesn't provide | ||||||||
the option you need to modify, you may override the | ||||||||
`sentryWebpackPluginOptions` using this option. | ||||||||
<Alert level="warning" title="Important"> | ||||||||
This option is considered unstable, and its API may change in a breaking way | ||||||||
in any release. | ||||||||
</Alert> | ||||||||
</SdkOption> | ||||||||
|
||||||||
<SdkOption name="widenClientFileUpload" type="boolean" defaultValue="false"> | ||||||||
|
||||||||
Include Next.js-internal code and code from dependencies when uploading source maps. | ||||||||
|
@@ -182,11 +197,47 @@ Automatically instrument components in the `app` directory with error monitoring | |||||||
|
||||||||
</SdkOption> | ||||||||
|
||||||||
<SdkOption name="excludeServerRoutes" type="Array<RegExp | string>"> | ||||||||
Exclude specific server-side API routes or pages from automatic Sentry instrumentation during build time. | ||||||||
This option takes an array of strings or regular expressions and affects pages in the `pages` and `app` directories. | ||||||||
|
||||||||
When defining routes, note the following: | ||||||||
|
||||||||
- Specify pages as routes and not as file system paths. For example, write `/animals` instead of `pages/animals/index.js`. | ||||||||
- Make sure that any provided string matches the route exactly, has a leading slash, and doesn't have a trailing slash. | ||||||||
|
||||||||
```javascript | ||||||||
excludeServerRoutes: [ | ||||||||
"/some/excluded/route", | ||||||||
"/excluded/route/with/[parameter]", | ||||||||
/^\/route\/beginning\/with\/some\/prefix/, | ||||||||
/\/routeContainingASpecificPathSegment\/?/, | ||||||||
]; | ||||||||
``` | ||||||||
|
||||||||
<Alert level="info"> | ||||||||
If you're building your Next.js application with Turbopack, this option will | ||||||||
have no effect. The Sentry SDK will no longer apply build-time instrumentation | ||||||||
and will rely purely on Next.js telemetry features. | ||||||||
</Alert> | ||||||||
|
||||||||
</SdkOption> | ||||||||
|
||||||||
<SdkOption name="tunnelRoute" type="string"> | ||||||||
<Alert level="info"> | ||||||||
This feature requires **Next.js version 11+** and doesn't currently work with self-hosted Sentry instances. | ||||||||
</Alert> | ||||||||
|
||||||||
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'). | ||||||||
Tunnel Sentry requests through this route on your Next.js server to prevent ad-blockers from blocking Sentry events from being sent. | ||||||||
This route should be a path, like `/error-monitoring`, as it adds an API endpoint within your application. | ||||||||
|
||||||||
Note: This feature only works with Next.js 11+ | ||||||||
Learn more about tunneling in the <PlatformLink to="/troubleshooting/#dealing-with-ad-blockers">troubleshooting section</PlatformLink>. | ||||||||
|
||||||||
<Expandable level="warning" title="Complications with Next.js middleware"> | ||||||||
Client-side event recording will fail if your Next.js middleware intercepts | ||||||||
the configured route. To prevent this, exclude the tunnel route by adding a | ||||||||
negative matcher to your middleware like `(?!monitoring-tunnel)`. | ||||||||
</Expandable> | ||||||||
|
||||||||
</SdkOption> | ||||||||
|
||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe move this out of Next.js specific options so it is at the same level but on the end of the page!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to the end of the section as discussed 👍