Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const config = {};
import { withSentryConfig } from '@sentry/nextjs';

export default withSentryConfig(config, {
disableLogger: true,
webpack: {
treeshake: {
removeDebugLogging: true,
},
},
silent: true,
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ const nextConfig: NextConfig = {};

export default withSentryConfig(nextConfig, {
silent: true,
_experimental: {
turbopackApplicationKey: 'nextjs-16-bun-e2e',
},
applicationKey: 'nextjs-16-bun-e2e',
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const nextConfig: NextConfig = {};

export default withSentryConfig(nextConfig, {
silent: true,
applicationKey: 'nextjs-16-streaming-e2e',
_experimental: {
vercelCronsMonitoring: true,
turbopackApplicationKey: 'nextjs-16-streaming-e2e',
turbopackReactComponentAnnotation: {
enabled: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const nextConfig: NextConfig = {

export default withSentryConfig(nextConfig, {
silent: true,
applicationKey: 'nextjs-16-e2e',
_experimental: {
vercelCronsMonitoring: true,
turbopackApplicationKey: 'nextjs-16-e2e',
turbopackReactComponentAnnotation: {
enabled: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ const config = {};
import { withSentryConfig } from '@sentry/nextjs';

export default withSentryConfig(config, {
disableLogger: true,
webpack: {
treeshake: {
removeDebugLogging: true,
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,27 @@ module.exports = withSentryConfig(module.exports, {
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,

// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},

// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
tunnelRoute: '/monitoring',

// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: false,

// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
webpack: {
Comment thread
chargome marked this conversation as resolved.
// Automatically annotate React components to show their full name in breadcrumbs and session replay
reactComponentAnnotation: {
enabled: true,
},

// Automatically tree-shake Sentry logger statements to reduce bundle size
treeshake: {
removeDebugLogging: false,
},

// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
},
});
29 changes: 16 additions & 13 deletions docs/migration/v11-end-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,19 +860,22 @@ Sentry.init({

### `@sentry/nextjs`

The following long-deprecated options in `withSentryConfig` / the `sentry` config were removed:

- `unstable_sentryWebpackPluginOptions`
- `autoInstrumentServerFunctions`
- `autoInstrumentMiddleware`
- `autoInstrumentAppDirectory`
- `disableLogger`
- `automaticVercelMonitors`
- `disableManifestInjection`
- `disableSentryWebpackConfig`
- `turbopackApplicationKey`

Remove these options from your `next.config.js` / `next.config.ts`.
The following long-deprecated top-level options in `withSentryConfig` / the `sentry` config were removed. Most of them
moved under the `webpack` option in v10; use the replacement listed below instead:

| Removed option | Replacement |
| --------------------------------------- | -------------------------------------------------------------- |
| `autoInstrumentServerFunctions` | `webpack.autoInstrumentServerFunctions` |
| `autoInstrumentMiddleware` | `webpack.autoInstrumentMiddleware` |
| `autoInstrumentAppDirectory` | `webpack.autoInstrumentAppDirectory` |
| `automaticVercelMonitors` | `webpack.automaticVercelMonitors` |
| `excludeServerRoutes` | `webpack.excludeServerRoutes` |
| `reactComponentAnnotation` | `webpack.reactComponentAnnotation` |
| `unstable_sentryWebpackPluginOptions` | `webpack.unstable_sentryWebpackPluginOptions` |
| `disableSentryWebpackConfig` | `webpack.disableSentryConfig` |
| `disableLogger` | `webpack.treeshake.removeDebugLogging` |
| `disableManifestInjection` | `routeManifestInjection: false` |
| `_experimental.turbopackApplicationKey` | `applicationKey` (works for both webpack and Turbopack builds) |

### Meta-framework build options

Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function init(options: BrowserOptions): Client | undefined {
consoleSandbox(() => {
// eslint-disable-next-line no-console
console.warn(
'[@sentry/nextjs] You have enabled `debug: true`, but Sentry debug logging was removed from your bundle (likely via `withSentryConfig({ disableLogger: true })` / `webpack.treeshake.removeDebugLogging: true`). Set that option to `false` to see Sentry debug output.',
'[@sentry/nextjs] You have enabled `debug: true`, but Sentry debug logging was removed from your bundle (likely via `webpack.treeshake.removeDebugLogging: true`). Set that option to `false` to see Sentry debug output.',
);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export function constructTurbopackConfig({
// so it is safe even for node_modules with strict initialization order.
// We only exclude Next.js build polyfills which contain non-standard syntax that causes
// parse errors when any code is prepended (Turbopack re-parses the loader output).
// eslint-disable-next-line typescript/no-deprecated
const applicationKey = userSentryOptions?.applicationKey ?? userSentryOptions?._experimental?.turbopackApplicationKey;
const applicationKey = userSentryOptions?.applicationKey;
if (applicationKey && nextJsVersion && supportsTurbopackRuleCondition(nextJsVersion)) {
newConfig.rules = safelyAddTurbopackRule(newConfig.rules, {
matcher: '*.{ts,tsx,js,jsx,mjs,cjs}',
Expand Down
116 changes: 0 additions & 116 deletions packages/nextjs/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,36 +531,6 @@ export type SentryBuildOptions = {
excludeReplayWorker?: boolean;
};

/**
* Options related to react component name annotations.
* Disabled by default, unless a value is set for this option.
* When enabled, your app's DOM will automatically be annotated during build-time with their respective component names.
* This will unlock the capability to search for Replays in Sentry by component name, as well as see component names in breadcrumbs and performance monitoring.
* Please note that this feature is not currently supported by the esbuild bundler plugins, and will only annotate React components
*
* @deprecated Use `webpack.reactComponentAnnotation` instead.
*/
reactComponentAnnotation?: {
/**
* Whether the component name annotate plugin should be enabled or not.
*/
enabled?: boolean;

/**
* A list of strings representing the names of components to ignore. The plugin will not apply `data-sentry` annotations on the DOM element for these components.
*/
ignoredComponents?: string[];
}; // TODO(v11): remove this option

/**
* Options to be passed directly to the Sentry Webpack Plugin (`@sentry/bundler-plugins/webpack`) that ships with the Sentry Next.js SDK.
* You can use this option to override any options the SDK passes to the webpack plugin.
*
* Please note that this option is unstable and may change in a breaking way in any release.
* @deprecated Use `webpack.unstable_sentryWebpackPluginOptions` instead.
*/
unstable_sentryWebpackPluginOptions?: SentryWebpackPluginOptions; // TODO(v11): remove this option

/**
* Include Next.js-internal code and code from dependencies when uploading source maps.
*
Expand All @@ -576,40 +546,6 @@ export type SentryBuildOptions = {
// TODO: Add an alias to this function called "uploadSourceMapsForDependencies"
widenClientFileUpload?: boolean;

/**
* Automatically instrument Next.js data fetching methods and Next.js API routes with error and performance monitoring.
* Defaults to `true`.
* @deprecated Use `webpack.autoInstrumentServerFunctions` instead.
*/
autoInstrumentServerFunctions?: boolean; // TODO(v11): remove this option

/**
* Automatically instrument Next.js middleware with error and performance monitoring. Defaults to `true`.
* @deprecated Use `webpack.autoInstrumentMiddleware` instead.
*/
autoInstrumentMiddleware?: boolean; // TODO(v11): remove this option

/**
* Automatically instrument components in the `app` directory with error monitoring. Defaults to `true`.
* @deprecated Use `webpack.autoInstrumentAppDirectory` instead.
*/
autoInstrumentAppDirectory?: boolean; // TODO(v11): remove this option

/**
* Exclude certain serverside API routes or pages from being instrumented with Sentry during build-time. This option
* takes an array of strings or regular expressions. This options also affects pages in the `app` directory.
*
* NOTE: Pages should be specified as routes (`/animals` or `/api/animals/[animalType]/habitat`), not filepaths
* (`pages/animals/index.js` or `.\src\pages\api\animals\[animalType]\habitat.tsx`), and strings must be be a full,
* exact match.
*
* Notice: If you build Next.js with turbopack, the Sentry SDK will no longer apply build-time instrumentation and
* purely rely on Next.js telemetry features, meaning that this option will effectively no-op.
*
* @deprecated Use `webpack.excludeServerRoutes` instead.
*/
excludeServerRoutes?: Array<RegExp | string>;

/**
* 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').
Expand All @@ -621,22 +557,6 @@ export type SentryBuildOptions = {
*/
tunnelRoute?: string | boolean;

/**
* Tree shakes Sentry SDK logger statements from the bundle.
*
* @deprecated Use `webpack.treeshake.removeDebugLogging` instead.
*/
disableLogger?: boolean; // TODO(v11): remove this option

/**
* Automatically create cron monitors in Sentry for your Vercel Cron Jobs if configured via `vercel.json`.
*
* Defaults to `false`.
*
* @deprecated Use `webpack.automaticVercelMonitors` instead.
*/
automaticVercelMonitors?: boolean; // TODO(v11): remove this option

/**
* When an error occurs during release creation or sourcemaps upload, the plugin will call this function.
*
Expand All @@ -659,15 +579,6 @@ export type SentryBuildOptions = {
*/
suppressOnRouterTransitionStartWarning?: boolean;

/**
* Disables automatic injection of the route manifest into the client bundle.
*
* @deprecated Use `routeManifestInjection: false` instead.
*
* @default false
*/
disableManifestInjection?: boolean; // TODO(v11): remove this option

/**
* Options for the route manifest injection feature.
*
Expand Down Expand Up @@ -716,20 +627,6 @@ export type SentryBuildOptions = {
exclude?: Array<string | RegExp> | ((route: string) => boolean);
};

/**
* Disables automatic injection of Sentry's Webpack configuration.
*
* By default, the Sentry Next.js SDK injects its own Webpack configuration to enable features such as
* source map upload and automatic instrumentation. Set this option to `true` if you want to prevent
* the SDK from modifying your Webpack config (for example, if you want to handle Sentry integration manually
* or if you are on an older version of Next.js while using Turbopack).
*
* @deprecated Use `webpack.disableSentryConfig` instead.
*
* @default false
*/
disableSentryWebpackConfig?: boolean; // TODO(v11): remove this option

/**
* When true (and Next.js >= 15), use the runAfterProductionCompile hook to consolidate sourcemap uploads
* into a single operation after builds complete, reducing build time.
Expand All @@ -753,19 +650,6 @@ export type SentryBuildOptions = {
* Requires cron jobs to be configured in `vercel.json`.
*/
vercelCronsMonitoring?: boolean;
/**
* Application key used by `thirdPartyErrorFilterIntegration` to distinguish
* first-party code from third-party code in Turbopack builds.
*
* When set, a Turbopack loader injects `_sentryModuleMetadata` into every
* first-party module, mirroring what `@sentry/bundler-plugins/webpack` does for
* webpack builds via its `moduleMetadata` / `applicationKey` option.
*
* Requires Next.js 16+
*
* @deprecated Use the top-level `applicationKey` option instead, which works for both webpack and Turbopack builds.
*/
turbopackApplicationKey?: string; // TODO(v11): remove this option
/**
* Options for React component name annotation in Turbopack builds.
* When enabled, JSX elements are annotated with `data-sentry-component`,
Expand Down
Loading
Loading