Skip to content

Commit 1acf54f

Browse files
author
Luca Forstner
authored
feat(nextjs): Bump minimum required Next.js version to 13.2.0 (#11097)
1 parent 557d846 commit 1acf54f

15 files changed

+240
-616
lines changed

MIGRATION.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ The following previously deprecated API has been removed from the `@sentry/nextj
630630
- `IS_BUILD`
631631
- `isBuild`
632632

633+
#### Updated minimum compatible Next.js version to `13.2.0`
634+
635+
The minimum version of Next.js compatible with the Sentry Next.js SDK has been raised to `13.2.0`. Older versions may
636+
exhibit bugs or unexpected behaviour.
637+
633638
#### Merging of the Sentry Webpack Plugin options and SDK Build options
634639

635640
With version 8 of the Sentry Next.js SDK, `withSentryConfig` will no longer accept 3 arguments. The second argument

packages/nextjs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
"@types/resolve": "1.20.3",
5353
"@types/webpack": "^4.41.31",
5454
"eslint-plugin-react": "^7.31.11",
55-
"next": "10.1.3"
55+
"next": "13.2.0"
5656
},
5757
"peerDependencies": {
58-
"next": "^10.0.8 || ^11.0 || ^12.0 || ^13.0 || ^14.0",
58+
"next": "^13.2.0 || ^14.0",
5959
"react": "16.x || 17.x || 18.x",
6060
"webpack": ">= 4.0.0"
6161
},

packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
import { WINDOW, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan } from '@sentry/react';
88
import type { Client, TransactionSource } from '@sentry/types';
99
import { browserPerformanceTimeOrigin, logger, stripUrlQueryAndFragment } from '@sentry/utils';
10-
import type { NEXT_DATA as NextData } from 'next/dist/next-server/lib/utils';
10+
11+
import type { NEXT_DATA } from 'next/dist/shared/lib/utils';
1112
import RouterImport from 'next/router';
1213

1314
// next/router v10 is CJS
@@ -27,7 +28,7 @@ const globalObject = WINDOW as typeof WINDOW & {
2728
/**
2829
* Describes data located in the __NEXT_DATA__ script tag. This tag is present on every page of a Next.js app.
2930
*/
30-
interface SentryEnhancedNextData extends NextData {
31+
interface SentryEnhancedNextData extends NEXT_DATA {
3132
props: {
3233
pageProps?: {
3334
_sentryTraceData?: string; // trace parent info, if injected by a data-fetcher

packages/nextjs/src/common/wrapGetServerSidePropsWithSentry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export function wrapGetServerSidePropsWithSentry(
4848
const activeSpan = getActiveSpan();
4949
const requestTransaction = getSpanFromRequest(req) ?? (activeSpan ? getRootSpan(activeSpan) : undefined);
5050
if (requestTransaction) {
51-
serverSideProps.props._sentryTraceData = spanToTraceHeader(requestTransaction);
51+
(serverSideProps.props as Record<string, unknown>)._sentryTraceData = spanToTraceHeader(requestTransaction);
5252

5353
const dynamicSamplingContext = getDynamicSamplingContextFromSpan(requestTransaction);
54-
serverSideProps.props._sentryBaggage = dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext);
54+
(serverSideProps.props as Record<string, unknown>)._sentryBaggage =
55+
dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContext);
5556
}
5657
}
5758

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference types="next/navigation-types/compat/navigation" />
34

45
// NOTE: This file should not be edited
56
// see https://nextjs.org/docs/basic-features/typescript for more information.

packages/nextjs/test/integration/next10.config.template

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/nextjs/test/integration/next11.config.template

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/nextjs/test/integration/next12.config.template

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/nextjs/test/integration/next13.appdir.config.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ const moduleExports = {
44
eslint: {
55
ignoreDuringBuilds: true,
66
},
7-
experimental: {
8-
appDir: Number(process.env.NODE_MAJOR) >= 16, // experimental.appDir requires Node v16.8.0 or later.
9-
},
107
pageExtensions: ['jsx', 'js', 'tsx', 'ts', 'page.tsx'],
118
};
129

packages/nextjs/test/integration/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"dependencies": {
1414
"@sentry/nextjs": "file:../../",
1515
"next": "latest",
16-
"react": "^17.0.1",
17-
"react-dom": "^17.0.1"
16+
"react": "^18.2.0",
17+
"react-dom": "^18.2.0"
1818
},
1919
"devDependencies": {
2020
"@types/node": "^15.3.1",

0 commit comments

Comments
 (0)