Unverified Commit 6194d642 authored by Andrew Clark's avatar Andrew Clark Committed by GitHub

Stabilize `forbidden()` and `unauthorized()` (#99689)

Moves the `forbidden()` and `unauthorized()` out of experimental and
deprecate the feature flag (`authInterrupts`) that they were gated
behind.

One caveat with these APIs is that the `forbidden.ts`/`unauthorized.ts`
boundaries are sent down eagerly as part of the normal page render. We
plan to optimize this later so they are only rendered lazily. (It's the
same optimization planned for error and not-found pages.)

<!-- NEXT_JS_LLM -->
parent 6fa344b8
......@@ -81,15 +81,3 @@ yarn add next@canary
```bash package="bun"
bun add next@canary
```
### Features available in canary
The following features are currently available in canary:
**Authentication**:
- [`forbidden`](/docs/app/api-reference/functions/forbidden)
- [`unauthorized`](/docs/app/api-reference/functions/unauthorized)
- [`forbidden.js`](/docs/app/api-reference/file-conventions/forbidden)
- [`unauthorized.js`](/docs/app/api-reference/file-conventions/unauthorized)
- [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts)
......@@ -108,7 +108,7 @@ export async function deletePost(postId: string) {
}
```
If you've enabled the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) flag, you can throw [`unauthorized()`](/docs/app/api-reference/functions/unauthorized) and [`forbidden()`](/docs/app/api-reference/functions/forbidden) from `next/navigation` instead, so Next.js renders the corresponding `unauthorized.tsx` / `forbidden.tsx` UI segment automatically.
You can also throw [`unauthorized()`](/docs/app/api-reference/functions/unauthorized) and [`forbidden()`](/docs/app/api-reference/functions/forbidden) from `next/navigation` instead, so Next.js renders the corresponding `unauthorized.tsx` / `forbidden.tsx` UI segment automatically.
For example, a client legitimately tells the server _which_ item to act on, but it should not supply the row's contents or ownership. Send a reference (typically an ID) plus the user's change, and re-read the rest from a trusted source using the session. Schema validation (zod or similar) only checks the _shape_ of the input. A well-formed `Item` object can still refer to a row the caller does not own.
......
......@@ -4,7 +4,6 @@ description: API reference for the forbidden.js special file.
related:
links:
- app/api-reference/functions/forbidden
version: experimental
---
The **forbidden** file renders UI when the [`forbidden`](/docs/app/api-reference/functions/forbidden) function is invoked.
......@@ -49,4 +48,5 @@ export default function Forbidden() {
| Version | Changes |
| --------- | -------------------------- |
| `v16.4.0` | `forbidden.js` is stable. |
| `v15.1.0` | `forbidden.js` introduced. |
......@@ -4,7 +4,6 @@ description: API reference for the unauthorized.js special file.
related:
links:
- app/api-reference/functions/unauthorized
version: experimental
---
The **unauthorized** file renders UI when the [`unauthorized`](/docs/app/api-reference/functions/unauthorized) function is invoked.
......@@ -113,4 +112,5 @@ export default function UnauthorizedPage() {
| Version | Changes |
| --------- | ----------------------------- |
| `v16.4.0` | `unauthorized.js` is stable. |
| `v15.1.0` | `unauthorized.js` introduced. |
---
title: forbidden
description: API Reference for the forbidden function.
version: experimental
related:
links:
- app/api-reference/file-conventions/forbidden
- app/api-reference/functions/not-found
- app/api-reference/functions/unauthorized
- app/api-reference/config/next-config-js/authInterrupts
---
The `forbidden` function throws an error that renders a Next.js 403 page. It's useful for handling authorization errors in your application. You can customize the UI using the [`forbidden.js` file](/docs/app/api-reference/file-conventions/forbidden).
Invoking `forbidden()` throws a `NEXT_HTTP_ERROR_FALLBACK;403` error and terminates rendering of the route segment where it was thrown. Next.js also injects a `<meta name="robots" content="noindex" />` tag so the page is not indexed. Because it works by throwing, call it in the render path: a component, or a function a component `await`s. A call left in an un-awaited promise throws where nothing catches it, and no forbidden UI renders.
To start using `forbidden`, enable the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) configuration option in your `next.config.js` file:
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
authInterrupts: true,
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
module.exports = {
experimental: {
authInterrupts: true,
},
}
```
`forbidden` can be invoked in [Server Components](/docs/app/getting-started/server-and-client-components), [Server Functions](/docs/app/getting-started/mutating-data), and [Route Handlers](/docs/app/api-reference/file-conventions/route).
```tsx filename="app/admin/page.tsx" switcher
......@@ -280,6 +256,7 @@ export async function updateRole(formData) {
## Version History
| Version | Changes |
| --------- | ----------------------- |
| `v15.1.0` | `forbidden` introduced. |
| Version | Changes |
| --------- | ---------------------------------------------------------------------------------- |
| `v16.4.0` | `forbidden` is stable. The `experimental.authInterrupts` flag is no longer needed. |
| `v15.1.0` | `forbidden` introduced. |
---
title: unauthorized
description: API Reference for the unauthorized function.
version: experimental
related:
links:
- app/api-reference/file-conventions/unauthorized
- app/api-reference/functions/not-found
- app/api-reference/functions/forbidden
- app/api-reference/config/next-config-js/authInterrupts
---
The `unauthorized` function throws an error that renders a Next.js 401 page. It's useful for handling authentication errors, when a request is not signed in. You can customize the UI using the [`unauthorized.js` file](/docs/app/api-reference/file-conventions/unauthorized).
Invoking `unauthorized()` throws a `NEXT_HTTP_ERROR_FALLBACK;401` error and terminates rendering of the route segment where it was thrown. Next.js also injects a `<meta name="robots" content="noindex" />` tag so the page is not indexed. Because it works by throwing, call it in the render path: a component, or a function a component `await`s. A call left in an un-awaited promise throws where nothing catches it, and no unauthorized UI renders.
To start using `unauthorized`, enable the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) configuration option in your `next.config.js` file:
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
authInterrupts: true,
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
module.exports = {
experimental: {
authInterrupts: true,
},
}
```
`unauthorized` can be invoked in [Server Components](/docs/app/getting-started/server-and-client-components), [Server Functions](/docs/app/getting-started/mutating-data), and [Route Handlers](/docs/app/api-reference/file-conventions/route).
```tsx filename="app/dashboard/page.tsx" switcher
......@@ -338,6 +314,7 @@ export async function GET() {
## Version History
| Version | Changes |
| --------- | -------------------------- |
| `v15.1.0` | `unauthorized` introduced. |
| Version | Changes |
| --------- | ------------------------------------------------------------------------------------- |
| `v16.4.0` | `unauthorized` is stable. The `experimental.authInterrupts` flag is no longer needed. |
| `v15.1.0` | `unauthorized` introduced. |
---
title: authInterrupts
description: Learn how to enable the experimental `authInterrupts` configuration option to use `forbidden` and `unauthorized`.
version: canary
description: Learn about the deprecated authInterrupts configuration option and how to update your configuration.
related:
links:
- app/api-reference/functions/forbidden
......@@ -10,24 +9,8 @@ related:
- app/api-reference/file-conventions/unauthorized
---
The `authInterrupts` configuration option allows you to use [`forbidden`](/docs/app/api-reference/functions/forbidden) and [`unauthorized`](/docs/app/api-reference/functions/unauthorized) APIs in your application. While these functions are experimental, you must enable the `authInterrupts` option in your `next.config.js` file to use them:
> **Deprecated**: `experimental.authInterrupts` is deprecated as of Next.js 16.4.0.
```ts filename="next.config.ts" switcher
import type { NextConfig } from 'next'
The [`forbidden()`](/docs/app/api-reference/functions/forbidden) and [`unauthorized()`](/docs/app/api-reference/functions/unauthorized) APIs are now stable and available by default.
const nextConfig: NextConfig = {
experimental: {
authInterrupts: true,
},
}
export default nextConfig
```
```js filename="next.config.js" switcher
module.exports = {
experimental: {
authInterrupts: true,
},
}
```
Remove `experimental.authInterrupts` from your `next.config.js` or `next.config.ts` file. The option has no effect: setting it to either `true` or `false` does not change the availability of these APIs.
/**
* Forbidden Auth
*
* Tests whether the agent uses the forbidden() function from next/navigation
* with authInterrupts enabled, plus a forbidden.tsx error boundary.
* Tests whether the agent uses the forbidden() function from next/navigation,
* plus a forbidden.tsx error boundary.
*
* Tricky because agents use redirect() or notFound() for authorization failures
* instead of the dedicated forbidden() API that returns a proper 403 status.
......@@ -12,16 +12,6 @@ import { expect, test } from 'vitest'
import { readFileSync, existsSync } from 'fs'
import { join } from 'path'
test('next.config enables authInterrupts', () => {
const configPath = join(process.cwd(), 'next.config.ts')
if (existsSync(configPath)) {
const content = readFileSync(configPath, 'utf-8')
// The forbidden() function requires authInterrupts: true
expect(content).toMatch(/authInterrupts\s*:\s*true/)
}
})
test('Admin page imports forbidden from next/navigation', () => {
const adminPagePath = join(process.cwd(), 'app', 'admin', 'page.tsx')
if (existsSync(adminPagePath)) {
......
......@@ -329,8 +329,6 @@ export function getDefineEnv({
'process.env.__NEXT_LINK_NO_TOUCH_START':
config.experimental.linkNoTouchStart ?? false,
'process.env.__NEXT_ASSET_PREFIX': config.assetPrefix,
'process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS':
!!config.experimental.authInterrupts,
'process.env.__NEXT_TELEMETRY_DISABLED': Boolean(
process.env.NEXT_TELEMETRY_DISABLED
),
......
......@@ -1790,9 +1790,6 @@ export default async function build(
)
const isAppCacheComponentsEnabled = Boolean(config.cacheComponents)
const isAuthInterruptsEnabled = Boolean(
config.experimental.authInterrupts
)
const isAppPPREnabled = isAppCacheComponentsEnabled
const routesManifestPath = path.join(distDir, ROUTES_MANIFEST)
......@@ -2411,7 +2408,6 @@ export default async function build(
configFileName,
cacheComponents: isAppCacheComponentsEnabled,
partialPrefetching: config.partialPrefetching,
authInterrupts: isAuthInterruptsEnabled,
useCacheTimeout: config.experimental.useCacheTimeout,
durableUseCacheEntries: Boolean(
config.experimental.durableUseCacheEntries
......@@ -2647,7 +2643,6 @@ export default async function build(
pageType,
cacheComponents: isAppCacheComponentsEnabled,
partialPrefetching: config.partialPrefetching,
authInterrupts: isAuthInterruptsEnabled,
useCacheTimeout:
config.experimental.useCacheTimeout,
durableUseCacheEntries: Boolean(
......
......@@ -868,7 +868,6 @@ export async function buildAppStaticPaths({
route,
distDir,
cacheComponents,
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
staticPageGenerationTimeout,
......@@ -893,7 +892,6 @@ export async function buildAppStaticPaths({
page: string
route: NormalizedAppRoute
cacheComponents: boolean
authInterrupts: boolean
useCacheTimeout: number
durableUseCacheEntries: boolean
staticPageGenerationTimeout: number
......@@ -970,7 +968,6 @@ export async function buildAppStaticPaths({
// TODO: remove validationLevel and other global config out of renderOpts
validationLevel: 'warning',
experimental: {
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
},
......
......@@ -1015,7 +1015,6 @@ export function createAppPageEntrypoint({
inlineCss: Boolean(nextConfig.experimental.inlineCss),
prefetchInlining:
nextConfig.experimental.prefetchInlining ?? false,
authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
reactBrowserBailout: Boolean(
nextConfig.experimental.reactBrowserBailout
),
......
......@@ -244,7 +244,6 @@ export async function handler(
previewProps,
renderOpts: {
experimental: {
authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
useCacheTimeout: nextConfig.experimental.useCacheTimeout,
durableUseCacheEntries: Boolean(
nextConfig.experimental.durableUseCacheEntries
......
......@@ -58,9 +58,6 @@ export async function handler(
trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),
experimental: {
cacheLife: process.env.__NEXT_CACHE_LIFE as any,
authInterrupts: Boolean(
process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS
),
clientParamParsingOrigins: process.env
.__NEXT_CLIENT_PARAM_PARSING_ORIGINS as any,
},
......
......@@ -194,7 +194,6 @@ async function requestHandler(
),
inlineCss: Boolean(nextConfig.experimental.inlineCss),
prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,
authInterrupts: Boolean(nextConfig.experimental.authInterrupts),
reactBrowserBailout: Boolean(
nextConfig.experimental.reactBrowserBailout
),
......@@ -463,9 +462,6 @@ export async function handler(
trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),
experimental: {
cacheLife: process.env.__NEXT_CACHE_LIFE as any,
authInterrupts: Boolean(
process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS
),
clientParamParsingOrigins: process.env
.__NEXT_CLIENT_PARAM_PARSING_ORIGINS as any,
},
......
......@@ -407,9 +407,6 @@ export async function handler(
trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),
experimental: {
cacheLife: process.env.__NEXT_CACHE_LIFE as any,
authInterrupts: Boolean(
process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS
),
clientParamParsingOrigins: process.env
.__NEXT_CLIENT_PARAM_PARSING_ORIGINS as any,
},
......
......@@ -123,9 +123,6 @@ export async function handler(
trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),
experimental: {
cacheLife: process.env.__NEXT_CACHE_LIFE as any,
authInterrupts: Boolean(
process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS
),
clientParamParsingOrigins: process.env
.__NEXT_CLIENT_PARAM_PARSING_ORIGINS as any,
},
......
......@@ -50,9 +50,6 @@ export async function handler(
trailingSlash: Boolean(process.env.__NEXT_TRAILING_SLASH),
experimental: {
cacheLife: process.env.__NEXT_CACHE_LIFE as any,
authInterrupts: Boolean(
process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS
),
clientParamParsingOrigins: process.env
.__NEXT_CLIENT_PARAM_PARSING_ORIGINS as any,
},
......
......@@ -795,7 +795,6 @@ export async function isPageStatic({
pageType,
cacheComponents,
partialPrefetching,
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
staticPageGenerationTimeout,
......@@ -816,7 +815,6 @@ export async function isPageStatic({
distDir: string
cacheComponents: boolean
partialPrefetching: boolean
authInterrupts: boolean
useCacheTimeout: number
durableUseCacheEntries: boolean
staticPageGenerationTimeout: number
......@@ -1013,7 +1011,6 @@ export async function isPageStatic({
page,
route,
cacheComponents,
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
staticPageGenerationTimeout,
......
......@@ -3,9 +3,7 @@ import {
type HTTPAccessFallbackError,
} from './http-access-fallback/http-access-fallback'
// TODO: Add `forbidden` docs
/**
* @experimental
* This function allows you to render the [forbidden.js file](https://nextjs.org/docs/app/api-reference/file-conventions/forbidden)
* within a route segment as well as inject a tag.
*
......@@ -20,12 +18,6 @@ import {
const DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};403`
export function forbidden(): never {
if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
throw new Error(
`\`forbidden()\` is experimental and only allowed to be enabled when \`experimental.authInterrupts\` is enabled.`
)
}
const error = new Error(DIGEST) as HTTPAccessFallbackError
;(error as HTTPAccessFallbackError).digest = DIGEST
throw error
......
......@@ -3,9 +3,7 @@ import {
type HTTPAccessFallbackError,
} from './http-access-fallback/http-access-fallback'
// TODO: Add `unauthorized` docs
/**
* @experimental
* This function allows you to render the [unauthorized.js file](https://nextjs.org/docs/app/api-reference/file-conventions/unauthorized)
* within a route segment as well as inject a tag.
*
......@@ -21,12 +19,6 @@ import {
const DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};401`
export function unauthorized(): never {
if (!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS) {
throw new Error(
`\`unauthorized()\` is experimental and only allowed to be used when \`experimental.authInterrupts\` is enabled.`
)
}
const error = new Error(DIGEST) as HTTPAccessFallbackError
;(error as HTTPAccessFallbackError).digest = DIGEST
throw error
......
......@@ -517,7 +517,6 @@ async function exportAppImpl(
nextConfig.experimental.parallelRouteMetadata ?? false,
inlineCss: nextConfig.experimental.inlineCss ?? false,
prefetchInlining: nextConfig.experimental.prefetchInlining ?? false,
authInterrupts: !!nextConfig.experimental.authInterrupts,
reactBrowserBailout: nextConfig.experimental.reactBrowserBailout ?? false,
useCacheTimeout: nextConfig.experimental.useCacheTimeout,
durableUseCacheEntries: Boolean(
......
......@@ -47,10 +47,7 @@ export async function exportAppRoute(
cacheComponents: boolean,
staticPageGenerationTimeout: number,
experimental: Required<
Pick<
ExperimentalConfig,
'authInterrupts' | 'useCacheTimeout' | 'durableUseCacheEntries'
>
Pick<ExperimentalConfig, 'useCacheTimeout' | 'durableUseCacheEntries'>
>,
buildId: string,
deploymentId: string,
......
......@@ -2120,7 +2120,6 @@ async function getRSCPayload(
rootLayoutIncluded: false,
missingSlots,
preloadCallbacks,
authInterrupts: ctx.renderOpts.experimental.authInterrupts,
MetadataOutlet,
isPrerendering,
hintTree: hints,
......
......@@ -68,7 +68,6 @@ type CreateComponentTreeProps = {
ctx: AppRenderContext
missingSlots?: Set<string>
preloadCallbacks: PreloadCallbacks
authInterrupts: boolean
MetadataOutlet: ComponentType<{ tree: LoaderTree }>
isPrerendering: boolean
hintTree: PrefetchHints | null
......@@ -134,7 +133,6 @@ async function createComponentTreeInternal(
ctx,
missingSlots,
preloadCallbacks,
authInterrupts,
MetadataOutlet,
isPrerendering,
hintTree,
......@@ -149,7 +147,6 @@ async function createComponentTreeInternal(
ctx: AppRenderContext
missingSlots?: Set<string>
preloadCallbacks: PreloadCallbacks
authInterrupts: boolean
MetadataOutlet: ComponentType<{ tree: LoaderTree }> | null
isPrerendering: boolean
hintTree: PrefetchHints | null
......@@ -279,27 +276,25 @@ async function createComponentTreeInternal(
})
: []
const [Forbidden, forbiddenStyles] =
authInterrupts && forbidden
? await createComponentStylesAndScripts({
ctx,
filePath: forbidden[1],
getComponent: forbidden[0],
injectedCSS: injectedCSSWithCurrentLayout,
injectedJS: injectedJSWithCurrentLayout,
})
: []
const [Forbidden, forbiddenStyles] = forbidden
? await createComponentStylesAndScripts({
ctx,
filePath: forbidden[1],
getComponent: forbidden[0],
injectedCSS: injectedCSSWithCurrentLayout,
injectedJS: injectedJSWithCurrentLayout,
})
: []
const [Unauthorized, unauthorizedStyles] =
authInterrupts && unauthorized
? await createComponentStylesAndScripts({
ctx,
filePath: unauthorized[1],
getComponent: unauthorized[0],
injectedCSS: injectedCSSWithCurrentLayout,
injectedJS: injectedJSWithCurrentLayout,
})
: []
const [Unauthorized, unauthorizedStyles] = unauthorized
? await createComponentStylesAndScripts({
ctx,
filePath: unauthorized[1],
getComponent: unauthorized[0],
injectedCSS: injectedCSSWithCurrentLayout,
injectedJS: injectedJSWithCurrentLayout,
})
: []
let dynamic = layoutOrPageMod?.dynamic
......@@ -622,7 +617,6 @@ async function createComponentTreeInternal(
ctx,
missingSlots,
preloadCallbacks,
authInterrupts,
MetadataOutlet:
experimental.parallelRouteMetadata || isChildrenRouteKey
? MetadataOutlet
......
......@@ -171,7 +171,6 @@ export interface RenderOptsPartial {
parallelRouteMetadata: boolean
inlineCss: boolean
prefetchInlining: PrefetchInliningConfig
authInterrupts: boolean
reactBrowserBailout: boolean
serverComponentsHmrCancellation?: boolean
useCacheTimeout: number
......
......@@ -266,7 +266,6 @@ export async function walkTreeWithFlightRouterState({
// This is intentionally not "rootLayoutIncludedAtThisLevelOrAbove" as createComponentTree starts at the current level and does a check for "rootLayoutAtThisLevel" too.
rootLayoutIncluded,
preloadCallbacks,
authInterrupts: experimental.authInterrupts,
MetadataOutlet,
isPrerendering: false,
hintTree,
......@@ -397,10 +396,7 @@ export async function createFullTreeForNavigation({
preloadCallbacks: PreloadCallbacks
MetadataOutlet: React.ComponentType<{ tree: LoaderTree }>
}): Promise<NavigationResponseTree> {
const {
renderOpts: { experimental },
pagePath,
} = ctx
const { pagePath } = ctx
const hintTreeForInitialRender =
ctx.renderOpts.prefetchHints?.[pagePath] ?? null
......@@ -416,7 +412,6 @@ export async function createFullTreeForNavigation({
injectedFontPreloadTags,
rootLayoutIncluded: false,
preloadCallbacks,
authInterrupts: experimental.authInterrupts,
MetadataOutlet,
isPrerendering: false,
hintTree: hintTreeForInitialRender,
......
......@@ -41,10 +41,7 @@ export type WorkStoreContext = {
pendingWaitUntil?: Promise<any>
experimental: Pick<
RenderOpts['experimental'],
| 'isRoutePPREnabled'
| 'authInterrupts'
| 'useCacheTimeout'
| 'durableUseCacheEntries'
'isRoutePPREnabled' | 'useCacheTimeout' | 'durableUseCacheEntries'
>
/**
......
......@@ -627,7 +627,6 @@ export default abstract class Server<
inlineCss: this.nextConfig.experimental.inlineCss ?? false,
prefetchInlining:
this.nextConfig.experimental.prefetchInlining ?? false,
authInterrupts: !!this.nextConfig.experimental.authInterrupts,
reactBrowserBailout:
this.nextConfig.experimental.reactBrowserBailout ?? false,
serverComponentsHmrCancellation:
......
......@@ -1462,9 +1462,9 @@ export interface ExperimentalConfig {
*/
inlineCss?: boolean
// TODO: Remove this config when the API is stable.
/**
* This config allows you to enable the experimental navigation API `forbidden` and `unauthorized`.
* @deprecated `forbidden()` and `unauthorized()` are available by default.
* This option has no effect and can be removed.
*/
authInterrupts?: boolean
......@@ -2456,7 +2456,6 @@ export const defaultConfig = Object.freeze({
parallelServerCompiles: false,
parallelServerBuildTraces: false,
ppr: false,
authInterrupts: false,
webpackBuildWorker: undefined,
webpackMemoryOptimizations: false,
optimizeServerReact: true,
......@@ -2576,7 +2575,6 @@ export interface NextConfigRuntime {
| 'parallelRouteMetadata'
| 'inlineCss'
| 'prefetchInlining'
| 'authInterrupts'
| 'reactBrowserBailout'
| 'useCacheTimeout'
| 'durableUseCacheEntries'
......@@ -2648,7 +2646,6 @@ export function getNextConfigRuntime(
parallelRouteMetadata: ex.parallelRouteMetadata,
inlineCss: ex.inlineCss,
prefetchInlining: ex.prefetchInlining,
authInterrupts: ex.authInterrupts,
reactBrowserBailout: ex.reactBrowserBailout,
useCacheTimeout: ex.useCacheTimeout,
durableUseCacheEntries: ex.durableUseCacheEntries,
......
......@@ -245,6 +245,13 @@ function checkDeprecations(
silent
)
warnOptionHasBeenDeprecated(
userConfig,
'experimental.authInterrupts',
`\`experimental.authInterrupts\` is no longer needed, because \`forbidden\` and \`unauthorized\` are available by default. You can remove it from ${configFileName}.`,
silent
)
warnOptionHasBeenDeprecated(
userConfig,
'eslint',
......
......@@ -766,7 +766,6 @@ export default class DevServer extends Server {
nextConfigOutput: this.nextConfig.output,
buildId: this.buildId,
deploymentId: this.deploymentId,
authInterrupts: Boolean(this.nextConfig.experimental.authInterrupts),
useCacheTimeout: this.nextConfig.experimental.useCacheTimeout,
durableUseCacheEntries: Boolean(
this.nextConfig.experimental.durableUseCacheEntries
......
......@@ -53,7 +53,6 @@ export async function loadStaticPaths({
nextConfigOutput,
buildId,
deploymentId,
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
staticPageGenerationTimeout,
......@@ -78,7 +77,6 @@ export async function loadStaticPaths({
nextConfigOutput: 'standalone' | 'export' | undefined
buildId: string
deploymentId: string
authInterrupts: boolean
useCacheTimeout: number
durableUseCacheEntries: boolean
staticPageGenerationTimeout: number
......@@ -161,7 +159,6 @@ export async function loadStaticPaths({
isEnsureStaticPage,
buildId,
deploymentId,
authInterrupts,
useCacheTimeout,
durableUseCacheEntries,
staticPageGenerationTimeout,
......
......@@ -334,8 +334,6 @@ export async function adapter(
validationLevel: 'warning',
experimental: {
isRoutePPREnabled: false,
authInterrupts:
!!params.request.nextConfig?.experimental?.authInterrupts,
// Proxy doesn't fill Cache Components entries, so this value
// is never read. 0 is a sentinel: if something ever reads it,
// the cache fill will time out immediately and surface the
......
......@@ -127,7 +127,6 @@ export class EdgeRouteModuleWrapper {
// TODO: Remove validationLevel and other global config from renderOpts
validationLevel: 'warning',
experimental: {
authInterrupts: !!process.env.__NEXT_EXPERIMENTAL_AUTH_INTERRUPTS,
// Edge runtime doesn't support Cache Components, so this value is
// never read. 0 is a sentinel: if something ever reads it, the cache
// fill will time out immediately and surface the bug.
......
......@@ -23,7 +23,7 @@ export interface RequestData {
trailingSlash?: boolean
experimental?: Pick<
ExperimentalConfig,
'cacheLife' | 'authInterrupts' | 'clientParamParsingOrigins'
'cacheLife' | 'clientParamParsingOrigins'
>
}
page?: {
......
......@@ -3,7 +3,6 @@
*/
const nextConfig = {
experimental: {
authInterrupts: true,
globalNotFound: true,
},
}
......
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
......@@ -4,7 +4,6 @@
const nextConfig = {
cacheComponents: true,
experimental: {
authInterrupts: true,
instantInsights: {
validationLevel: 'manual-warning',
},
......
......@@ -3,7 +3,6 @@
*/
const nextConfig = {
experimental: {
authInterrupts: true,
explicitParallelRouteChildren: true,
},
}
......
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
/** @type {import('next').NextConfig} */
module.exports = {
experimental: {
authInterrupts: true,
},
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment