From c22787fe2788b2b720305e8c2390ee265601ce8e Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 22 Sep 2022 07:52:29 +0000 Subject: [PATCH] feat(nextjs): Promote option to automatically wrap data fetchers and API routes to non-experimental --- packages/nextjs/src/config/types.ts | 6 ++---- packages/nextjs/src/config/webpack.ts | 2 +- packages/nextjs/test/integration/next.config.js | 2 +- packages/nextjs/test/integration/next10.config.template | 2 +- packages/nextjs/test/integration/next11.config.template | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/src/config/types.ts b/packages/nextjs/src/config/types.ts index 83e597f07a45..9b4eef3e9569 100644 --- a/packages/nextjs/src/config/types.ts +++ b/packages/nextjs/src/config/types.ts @@ -55,10 +55,8 @@ export type UserSentryOptions = { // up uploading too many files, which is why this defaults to `false`. widenClientFileUpload?: boolean; - experiments?: { - // Automatically wrap `getInitialProps`, `getServerSideProps`, and `getStaticProps` in order to instrument them for tracing. - autoWrapDataFetchers?: boolean; - }; + // Automatically instrument Next.js data fetching methods and Next.js API routes + autoInstrumentServerFunctions?: boolean; }; export type NextConfigFunction = (phase: string, defaults: { defaultConfig: NextConfigObject }) => NextConfigObject; diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 84650b80e3c7..3eb55702d427 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -79,7 +79,7 @@ export function constructWebpackConfigFunction( ], }; - if (userSentryOptions.experiments?.autoWrapDataFetchers) { + if (userSentryOptions.autoInstrumentServerFunctions) { const pagesDir = newConfig.resolve?.alias?.['private-next-pages'] as string; newConfig.module.rules.push({ diff --git a/packages/nextjs/test/integration/next.config.js b/packages/nextjs/test/integration/next.config.js index 7d5dcf489e04..267e07b19ee9 100644 --- a/packages/nextjs/test/integration/next.config.js +++ b/packages/nextjs/test/integration/next.config.js @@ -5,7 +5,7 @@ const moduleExports = { ignoreDuringBuilds: true, }, sentry: { - experiments: { autoWrapDataFetchers: true }, + autoInstrumentServerFunctions: true, // Suppress the warning message from `handleSourcemapHidingOptionWarning` in `src/config/webpack.ts` // TODO (v8): This can come out in v8, because this option will get a default value hideSourceMaps: false, diff --git a/packages/nextjs/test/integration/next10.config.template b/packages/nextjs/test/integration/next10.config.template index 9f031617ed34..5277a715f666 100644 --- a/packages/nextjs/test/integration/next10.config.template +++ b/packages/nextjs/test/integration/next10.config.template @@ -6,7 +6,7 @@ const moduleExports = { webpack5: %RUN_WEBPACK_5%, }, sentry: { - experiments: { autoWrapDataFetchers: true }, + autoInstrumentServerFunctions: true, // Suppress the warning message from `handleSourcemapHidingOptionWarning` in `src/config/webpack.ts` // TODO (v8): This can come out in v8, because this option will get a default value hideSourceMaps: false, diff --git a/packages/nextjs/test/integration/next11.config.template b/packages/nextjs/test/integration/next11.config.template index 4de57e2720ed..446f5d1f29a6 100644 --- a/packages/nextjs/test/integration/next11.config.template +++ b/packages/nextjs/test/integration/next11.config.template @@ -7,7 +7,7 @@ const moduleExports = { ignoreDuringBuilds: true, }, sentry: { - experiments: { autoWrapDataFetchers: true }, + autoInstrumentServerFunctions: true, // Suppress the warning message from `handleSourcemapHidingOptionWarning` in `src/config/webpack.ts` // TODO (v8): This can come out in v8, because this option will get a default value hideSourceMaps: false,