next 15.4.0-canary.7 → 15.4.0-canary.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack-config.js +2 -2
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +2 -2
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack-config.js +2 -2
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/base-server.js +4 -2
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/server/next-server.js +2 -0
- package/dist/esm/server/next-server.js.map +1 -1
- package/dist/esm/shared/lib/canary-only.js +1 -1
- package/dist/server/base-server.js +4 -2
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/server/next-server.js +2 -0
- package/dist/server/next-server.js.map +1 -1
- package/dist/shared/lib/canary-only.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/server/base-server.ts"],"sourcesContent":["import type { __ApiPreviewProps } from './api-utils'\nimport type { LoadComponentsReturnType } from './load-components'\nimport type { MiddlewareRouteMatch } from '../shared/lib/router/utils/middleware-route-matcher'\nimport type { Params } from './request/params'\nimport {\n type FallbackRouteParams,\n getFallbackRouteParams,\n} from './request/fallback-params'\nimport type { NextConfig, NextConfigComplete } from './config-shared'\nimport type {\n NextParsedUrlQuery,\n NextUrlWithParsedQuery,\n RequestMeta,\n} from './request-meta'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { RenderOptsPartial as PagesRenderOptsPartial } from './render'\nimport type {\n RenderOptsPartial as AppRenderOptsPartial,\n ServerOnInstrumentationRequestError,\n} from './app-render/types'\nimport {\n type CachedAppPageValue,\n type CachedPageValue,\n type ServerComponentsHmrCache,\n type ResponseCacheBase,\n type ResponseCacheEntry,\n type ResponseGenerator,\n CachedRouteKind,\n type CachedRedirectValue,\n} from './response-cache'\nimport type { UrlWithParsedQuery } from 'url'\nimport {\n NormalizeError,\n DecodeError,\n normalizeRepeatedSlashes,\n MissingStaticPage,\n} from '../shared/lib/utils'\nimport type { PreviewData } from '../types'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\nimport type { BaseNextRequest, BaseNextResponse } from './base-http'\nimport type {\n ManifestRewriteRoute,\n ManifestRoute,\n PrerenderManifest,\n} from '../build'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type { NextFontManifest } from '../build/webpack/plugins/next-font-manifest-plugin'\nimport type {\n AppPageRouteHandlerContext,\n AppPageRouteModule,\n} from './route-modules/app-page/module'\nimport type { PagesAPIRouteMatch } from './route-matches/pages-api-route-match'\nimport type { AppRouteRouteHandlerContext } from './route-modules/app-route/module'\nimport type {\n Server as HTTPServer,\n IncomingMessage,\n ServerResponse as HTTPServerResponse,\n} from 'http'\nimport type { MiddlewareMatcher } from '../build/analysis/get-page-static-info'\nimport type { TLSSocket } from 'tls'\nimport type { PathnameNormalizer } from './normalizers/request/pathname-normalizer'\nimport type { InstrumentationModule } from './instrumentation/types'\n\nimport { format as formatUrl, parse as parseUrl } from 'url'\nimport { formatHostname } from './lib/format-hostname'\nimport { getRedirectStatus } from '../lib/redirect-status'\nimport { isEdgeRuntime } from '../lib/is-edge-runtime'\nimport {\n APP_PATHS_MANIFEST,\n NEXT_BUILTIN_DOCUMENT,\n PAGES_MANIFEST,\n STATIC_STATUS_PAGES,\n UNDERSCORE_NOT_FOUND_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../shared/lib/constants'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { checkIsOnDemandRevalidate } from './api-utils'\nimport { setConfig } from '../shared/lib/runtime-config.external'\nimport { getCacheControlHeader, type CacheControl } from './lib/cache-control'\nimport { execOnce } from '../shared/lib/utils'\nimport { isBlockedPage } from './utils'\nimport { getBotType, isBot } from '../shared/lib/router/utils/is-bot'\nimport RenderResult from './render-result'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport * as Log from '../build/output/log'\nimport { getPreviouslyRevalidatedTags, getUtils } from './server-utils'\nimport isError, { getProperError } from '../lib/is-error'\nimport {\n addRequestMeta,\n getRequestMeta,\n removeRequestMeta,\n setRequestMeta,\n} from './request-meta'\nimport { removePathPrefix } from '../shared/lib/router/utils/remove-path-prefix'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport { getHostname } from '../shared/lib/get-hostname'\nimport { parseUrl as parseUrlUtil } from '../shared/lib/router/utils/parse-url'\nimport { getNextPathnameInfo } from '../shared/lib/router/utils/get-next-pathname-info'\nimport {\n RSC_HEADER,\n NEXT_RSC_UNION_QUERY,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_DID_POSTPONE_HEADER,\n NEXT_URL,\n NEXT_IS_PRERENDER_HEADER,\n} from '../client/components/app-router-headers'\nimport type {\n MatchOptions,\n RouteMatcherManager,\n} from './route-matcher-managers/route-matcher-manager'\nimport { LocaleRouteNormalizer } from './normalizers/locale-route-normalizer'\nimport { DefaultRouteMatcherManager } from './route-matcher-managers/default-route-matcher-manager'\nimport { AppPageRouteMatcherProvider } from './route-matcher-providers/app-page-route-matcher-provider'\nimport { AppRouteRouteMatcherProvider } from './route-matcher-providers/app-route-route-matcher-provider'\nimport { PagesAPIRouteMatcherProvider } from './route-matcher-providers/pages-api-route-matcher-provider'\nimport { PagesRouteMatcherProvider } from './route-matcher-providers/pages-route-matcher-provider'\nimport { ServerManifestLoader } from './route-matcher-providers/helpers/manifest-loaders/server-manifest-loader'\nimport { getTracer, isBubbledError, SpanKind } from './lib/trace/tracer'\nimport { BaseServerSpan } from './lib/trace/constants'\nimport { I18NProvider } from './lib/i18n-provider'\nimport { sendResponse } from './send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n normalizeNextQueryParam,\n toNodeOutgoingHttpHeaders,\n} from './web/utils'\nimport {\n CACHE_ONE_YEAR,\n INFINITE_CACHE,\n MATCHED_PATH_HEADER,\n NEXT_CACHE_TAGS_HEADER,\n NEXT_RESUME_HEADER,\n} from '../lib/constants'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from './web/spec-extension/adapters/next-request'\nimport { matchNextDataPathname } from './lib/match-next-data-pathname'\nimport getRouteFromAssetPath from '../shared/lib/router/utils/get-route-from-asset-path'\nimport { decodePathParams } from './lib/router-utils/decode-path-params'\nimport { RSCPathnameNormalizer } from './normalizers/request/rsc'\nimport { stripFlightHeaders } from './app-render/strip-flight-headers'\nimport {\n isAppPageRouteModule,\n isAppRouteRouteModule,\n isPagesRouteModule,\n} from './route-modules/checks'\nimport { PrefetchRSCPathnameNormalizer } from './normalizers/request/prefetch-rsc'\nimport { NextDataPathnameNormalizer } from './normalizers/request/next-data'\nimport { getIsPossibleServerAction } from './lib/server-action-request-meta'\nimport { isInterceptionRouteAppPath } from '../shared/lib/router/utils/interception-routes'\nimport { toRoute } from './lib/to-route'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isNodeNextRequest, isNodeNextResponse } from './base-http/helpers'\nimport { patchSetHeaderWithCookieSupport } from './lib/patch-set-header'\nimport { checkIsAppPPREnabled } from './lib/experimental/ppr'\nimport {\n getBuiltinRequestContext,\n type WaitUntil,\n} from './after/builtin-request-context'\nimport { ENCODED_TAGS } from './stream-utils/encodedTags'\nimport { NextRequestHint } from './web/adapter'\nimport { getRevalidateReason } from './instrumentation/utils'\nimport { RouteKind } from './route-kind'\nimport type { RouteModule } from './route-modules/route-module'\nimport { FallbackMode, parseFallbackField } from '../lib/fallback'\nimport { toResponseCacheEntry } from './response-cache/utils'\nimport { scheduleOnNextTick } from '../lib/scheduler'\nimport { SegmentPrefixRSCPathnameNormalizer } from './normalizers/request/segment-prefix-rsc'\nimport {\n shouldServeStreamingMetadata,\n isHtmlBotRequest,\n} from './lib/streaming-metadata'\nimport { InvariantError } from '../shared/lib/invariant-error'\nimport { decodeQueryPathParameter } from './lib/decode-query-path-parameter'\nimport { getCacheHandlers } from './use-cache/handlers'\n\nexport type FindComponentsResult = {\n components: LoadComponentsReturnType\n query: NextParsedUrlQuery\n}\n\nexport interface MiddlewareRoutingItem {\n page: string\n match: MiddlewareRouteMatch\n matchers?: MiddlewareMatcher[]\n}\n\nexport type RouteHandler<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: NextUrlWithParsedQuery\n) => PromiseLike<boolean> | boolean\n\n/**\n * The normalized route manifest is the same as the route manifest, but with\n * the rewrites normalized to the object shape that the router expects.\n */\nexport type NormalizedRouteManifest = {\n readonly dynamicRoutes: ReadonlyArray<ManifestRoute>\n readonly rewrites: {\n readonly beforeFiles: ReadonlyArray<ManifestRewriteRoute>\n readonly afterFiles: ReadonlyArray<ManifestRewriteRoute>\n readonly fallback: ReadonlyArray<ManifestRewriteRoute>\n }\n}\n\nexport interface Options {\n /**\n * Object containing the configuration next.config.js\n */\n conf: NextConfig\n /**\n * Set to false when the server was created by Next.js\n */\n customServer?: boolean\n /**\n * Tells if Next.js is running in dev mode\n */\n dev?: boolean\n /**\n * Enables the experimental testing mode.\n */\n experimentalTestProxy?: boolean\n\n /**\n * Whether or not the dev server is running in experimental HTTPS mode\n */\n experimentalHttpsServer?: boolean\n /**\n * Where the Next project is located\n */\n dir?: string\n /**\n * Tells if Next.js is at the platform-level\n */\n minimalMode?: boolean\n /**\n * Hide error messages containing server information\n */\n quiet?: boolean\n /**\n * The hostname the server is running behind\n */\n hostname?: string\n /**\n * The port the server is running behind\n */\n port?: number\n /**\n * The HTTP Server that Next.js is running behind\n */\n httpServer?: HTTPServer\n}\n\nexport type RenderOpts = PagesRenderOptsPartial & AppRenderOptsPartial\n\nexport type LoadedRenderOpts = RenderOpts &\n LoadComponentsReturnType &\n RequestLifecycleOpts\n\nexport type RequestLifecycleOpts = {\n waitUntil: ((promise: Promise<any>) => void) | undefined\n onClose: (callback: () => void) => void\n onAfterTaskError: ((error: unknown) => void) | undefined\n}\n\ntype BaseRenderOpts = RenderOpts & {\n poweredByHeader: boolean\n generateEtags: boolean\n previewProps: __ApiPreviewProps\n}\n\n/**\n * The public interface for rendering with the server programmatically. This\n * would typically only allow the base request or response to extend it, but\n * because this can be programmatically accessed, we assume that it could also\n * be the base Node.js request and response types.\n */\nexport interface BaseRequestHandler<\n ServerRequest extends BaseNextRequest | IncomingMessage = BaseNextRequest,\n ServerResponse extends\n | BaseNextResponse\n | HTTPServerResponse = BaseNextResponse,\n> {\n (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery | undefined\n ): Promise<void> | void\n}\n\nexport type RequestContext<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = {\n req: ServerRequest\n res: ServerResponse\n pathname: string\n query: NextParsedUrlQuery\n renderOpts: RenderOpts\n}\n\nexport class NoFallbackError extends Error {}\n\n// Internal wrapper around build errors at development\n// time, to prevent us from propagating or logging them\nexport class WrappedBuildError extends Error {\n innerError: Error\n\n constructor(innerError: Error) {\n super()\n this.innerError = innerError\n }\n}\n\ntype ResponsePayload = {\n type: 'html' | 'json' | 'rsc'\n body: RenderResult\n cacheControl?: CacheControl\n}\n\nexport type NextEnabledDirectories = {\n readonly pages: boolean\n readonly app: boolean\n}\n\nexport default abstract class Server<\n ServerOptions extends Options = Options,\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> {\n public readonly hostname?: string\n public readonly fetchHostname?: string\n public readonly port?: number\n protected readonly dir: string\n protected readonly quiet: boolean\n protected readonly nextConfig: NextConfigComplete\n protected readonly distDir: string\n protected readonly publicDir: string\n protected readonly hasStaticDir: boolean\n protected readonly pagesManifest?: PagesManifest\n protected readonly appPathsManifest?: PagesManifest\n protected readonly buildId: string\n protected readonly minimalMode: boolean\n protected readonly renderOpts: BaseRenderOpts\n protected readonly serverOptions: Readonly<ServerOptions>\n protected readonly appPathRoutes?: Record<string, string[]>\n protected readonly clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n protected interceptionRoutePatterns: RegExp[]\n protected nextFontManifest?: DeepReadonly<NextFontManifest>\n protected instrumentation: InstrumentationModule | undefined\n private readonly responseCache: ResponseCacheBase\n\n protected abstract getPublicDir(): string\n protected abstract getHasStaticDir(): boolean\n protected abstract getPagesManifest(): PagesManifest | undefined\n protected abstract getAppPathsManifest(): PagesManifest | undefined\n protected abstract getBuildId(): string\n protected abstract getinterceptionRoutePatterns(): RegExp[]\n\n protected readonly enabledDirectories: NextEnabledDirectories\n protected abstract getEnabledDirectories(dev: boolean): NextEnabledDirectories\n\n protected readonly experimentalTestProxy?: boolean\n\n protected abstract findPageComponents(params: {\n locale: string | undefined\n page: string\n query: NextParsedUrlQuery\n params: Params\n isAppPath: boolean\n // The following parameters are used in the development server's\n // implementation.\n sriEnabled?: boolean\n appPaths?: ReadonlyArray<string> | null\n shouldEnsure?: boolean\n url?: string\n }): Promise<FindComponentsResult | null>\n protected abstract getPrerenderManifest(): DeepReadonly<PrerenderManifest>\n protected abstract getNextFontManifest():\n | DeepReadonly<NextFontManifest>\n | undefined\n protected abstract attachRequestMeta(\n req: ServerRequest,\n parsedUrl: NextUrlWithParsedQuery\n ): void\n protected abstract hasPage(pathname: string): Promise<boolean>\n\n protected abstract sendRenderResult(\n req: ServerRequest,\n res: ServerResponse,\n options: {\n result: RenderResult\n type: 'html' | 'json' | 'rsc'\n generateEtags: boolean\n poweredByHeader: boolean\n cacheControl: CacheControl | undefined\n }\n ): Promise<void>\n\n protected abstract runApi(\n req: ServerRequest,\n res: ServerResponse,\n query: ParsedUrlQuery,\n match: PagesAPIRouteMatch\n ): Promise<boolean>\n\n protected abstract renderHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: LoadedRenderOpts\n ): Promise<RenderResult>\n\n protected abstract getIncrementalCache(options: {\n requestHeaders: Record<string, undefined | string | string[]>\n requestProtocol: 'http' | 'https'\n }): Promise<import('./lib/incremental-cache').IncrementalCache>\n\n protected abstract getResponseCache(options: {\n dev: boolean\n }): ResponseCacheBase\n\n protected getServerComponentsHmrCache():\n | ServerComponentsHmrCache\n | undefined {\n return this.nextConfig.experimental.serverComponentsHmrCache\n ? (globalThis as any).__serverComponentsHmrCache\n : undefined\n }\n\n protected abstract loadEnvConfig(params: {\n dev: boolean\n forceReload?: boolean\n }): void\n\n // TODO-APP: (wyattjoh): Make protected again. Used for turbopack in route-resolver.ts right now.\n public readonly matchers: RouteMatcherManager\n protected readonly i18nProvider?: I18NProvider\n protected readonly localeNormalizer?: LocaleRouteNormalizer\n\n protected readonly normalizers: {\n readonly rsc: RSCPathnameNormalizer | undefined\n readonly prefetchRSC: PrefetchRSCPathnameNormalizer | undefined\n readonly segmentPrefetchRSC: SegmentPrefixRSCPathnameNormalizer | undefined\n readonly data: NextDataPathnameNormalizer | undefined\n }\n\n private readonly isAppPPREnabled: boolean\n private readonly isAppSegmentPrefetchEnabled: boolean\n\n /**\n * This is used to persist cache scopes across\n * prefetch -> full route requests for dynamic IO\n * it's only fully used in dev\n */\n\n public constructor(options: ServerOptions) {\n const {\n dir = '.',\n quiet = false,\n conf,\n dev = false,\n minimalMode = false,\n hostname,\n port,\n experimentalTestProxy,\n } = options\n\n this.experimentalTestProxy = experimentalTestProxy\n this.serverOptions = options\n\n this.dir =\n process.env.NEXT_RUNTIME === 'edge' ? dir : require('path').resolve(dir)\n\n this.quiet = quiet\n this.loadEnvConfig({ dev })\n\n // TODO: should conf be normalized to prevent missing\n // values from causing issues as this can be user provided\n this.nextConfig = conf as NextConfigComplete\n this.hostname = hostname\n if (this.hostname) {\n // we format the hostname so that it can be fetched\n this.fetchHostname = formatHostname(this.hostname)\n }\n this.port = port\n this.distDir =\n process.env.NEXT_RUNTIME === 'edge'\n ? this.nextConfig.distDir\n : require('path').join(this.dir, this.nextConfig.distDir)\n this.publicDir = this.getPublicDir()\n this.hasStaticDir = !minimalMode && this.getHasStaticDir()\n\n this.i18nProvider = this.nextConfig.i18n?.locales\n ? new I18NProvider(this.nextConfig.i18n)\n : undefined\n\n // Configure the locale normalizer, it's used for routes inside `pages/`.\n this.localeNormalizer = this.i18nProvider\n ? new LocaleRouteNormalizer(this.i18nProvider)\n : undefined\n\n // Only serverRuntimeConfig needs the default\n // publicRuntimeConfig gets it's default in client/index.js\n const {\n serverRuntimeConfig = {},\n publicRuntimeConfig,\n assetPrefix,\n generateEtags,\n } = this.nextConfig\n\n this.buildId = this.getBuildId()\n // this is a hack to avoid Webpack knowing this is equal to this.minimalMode\n // because we replace this.minimalMode to true in production bundles.\n const minimalModeKey = 'minimalMode'\n this[minimalModeKey] =\n minimalMode || !!process.env.NEXT_PRIVATE_MINIMAL_MODE\n\n this.enabledDirectories = this.getEnabledDirectories(dev)\n\n this.isAppPPREnabled =\n this.enabledDirectories.app &&\n checkIsAppPPREnabled(this.nextConfig.experimental.ppr)\n\n this.isAppSegmentPrefetchEnabled =\n this.enabledDirectories.app &&\n this.nextConfig.experimental.clientSegmentCache === true\n\n this.normalizers = {\n // We should normalize the pathname from the RSC prefix only in minimal\n // mode as otherwise that route is not exposed external to the server as\n // we instead only rely on the headers.\n rsc:\n this.enabledDirectories.app && this.minimalMode\n ? new RSCPathnameNormalizer()\n : undefined,\n prefetchRSC:\n this.isAppPPREnabled && this.minimalMode\n ? new PrefetchRSCPathnameNormalizer()\n : undefined,\n segmentPrefetchRSC:\n this.isAppSegmentPrefetchEnabled && this.minimalMode\n ? new SegmentPrefixRSCPathnameNormalizer()\n : undefined,\n data: this.enabledDirectories.pages\n ? new NextDataPathnameNormalizer(this.buildId)\n : undefined,\n }\n\n this.nextFontManifest = this.getNextFontManifest()\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n process.env.NEXT_DEPLOYMENT_ID = this.nextConfig.deploymentId || ''\n }\n\n this.renderOpts = {\n supportsDynamicResponse: true,\n trailingSlash: this.nextConfig.trailingSlash,\n deploymentId: this.nextConfig.deploymentId,\n strictNextHead: this.nextConfig.experimental.strictNextHead ?? true,\n poweredByHeader: this.nextConfig.poweredByHeader,\n canonicalBase: this.nextConfig.amp.canonicalBase || '',\n generateEtags,\n previewProps: this.getPrerenderManifest().preview,\n ampOptimizerConfig: this.nextConfig.experimental.amp?.optimizer,\n basePath: this.nextConfig.basePath,\n images: this.nextConfig.images,\n optimizeCss: this.nextConfig.experimental.optimizeCss,\n nextConfigOutput: this.nextConfig.output,\n nextScriptWorkers: this.nextConfig.experimental.nextScriptWorkers,\n disableOptimizedLoading:\n this.nextConfig.experimental.disableOptimizedLoading,\n domainLocales: this.nextConfig.i18n?.domains,\n distDir: this.distDir,\n serverComponents: this.enabledDirectories.app,\n cacheLifeProfiles: this.nextConfig.experimental.cacheLife,\n enableTainting: this.nextConfig.experimental.taint,\n crossOrigin: this.nextConfig.crossOrigin\n ? this.nextConfig.crossOrigin\n : undefined,\n largePageDataBytes: this.nextConfig.experimental.largePageDataBytes,\n // Only the `publicRuntimeConfig` key is exposed to the client side\n // It'll be rendered as part of __NEXT_DATA__ on the client side\n runtimeConfig:\n Object.keys(publicRuntimeConfig).length > 0\n ? publicRuntimeConfig\n : undefined,\n\n // @ts-expect-error internal field not publicly exposed\n isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile,\n // `htmlLimitedBots` is passed to server as serialized config in string format\n htmlLimitedBots: this.nextConfig.htmlLimitedBots,\n experimental: {\n expireTime: this.nextConfig.expireTime,\n clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata,\n dynamicIO: this.nextConfig.experimental.dynamicIO ?? false,\n clientSegmentCache:\n this.nextConfig.experimental.clientSegmentCache === 'client-only'\n ? 'client-only'\n : Boolean(this.nextConfig.experimental.clientSegmentCache),\n dynamicOnHover: this.nextConfig.experimental.dynamicOnHover ?? false,\n inlineCss: this.nextConfig.experimental.inlineCss ?? false,\n authInterrupts: !!this.nextConfig.experimental.authInterrupts,\n },\n onInstrumentationRequestError:\n this.instrumentationOnRequestError.bind(this),\n reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength,\n }\n\n // Initialize next/config with the environment configuration\n setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig,\n })\n\n this.pagesManifest = this.getPagesManifest()\n this.appPathsManifest = this.getAppPathsManifest()\n this.appPathRoutes = this.getAppPathRoutes()\n this.interceptionRoutePatterns = this.getinterceptionRoutePatterns()\n\n // Configure the routes.\n this.matchers = this.getRouteMatchers()\n\n // Start route compilation. We don't wait for the routes to finish loading\n // because we use the `waitTillReady` promise below in `handleRequest` to\n // wait. Also we can't `await` in the constructor.\n void this.matchers.reload()\n\n this.setAssetPrefix(assetPrefix)\n this.responseCache = this.getResponseCache({ dev })\n }\n\n protected reloadMatchers() {\n return this.matchers.reload()\n }\n\n private handleRSCRequest: RouteHandler<ServerRequest, ServerResponse> = (\n req,\n _res,\n parsedUrl\n ) => {\n if (!parsedUrl.pathname) return false\n\n if (this.normalizers.segmentPrefetchRSC?.match(parsedUrl.pathname)) {\n const result = this.normalizers.segmentPrefetchRSC.extract(\n parsedUrl.pathname\n )\n if (!result) return false\n\n const { originalPathname, segmentPath } = result\n parsedUrl.pathname = originalPathname\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()] =\n segmentPath\n\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n addRequestMeta(req, 'segmentPrefetchRSCRequest', segmentPath)\n } else if (this.normalizers.prefetchRSC?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.prefetchRSC.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n } else if (this.normalizers.rsc?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.rsc.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a RSC request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n } else if (req.headers['x-now-route-matches']) {\n // If we didn't match, return with the flight headers stripped. If in\n // minimal mode we didn't match based on the path, this can't be a RSC\n // request. This is because Vercel only sends this header during\n // revalidation requests and we want the cache to instead depend on the\n // request path for flight information.\n stripFlightHeaders(req.headers)\n\n return false\n } else if (req.headers[RSC_HEADER.toLowerCase()] === '1') {\n addRequestMeta(req, 'isRSCRequest', true)\n\n if (req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] === '1') {\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n\n const segmentPrefetchRSCRequest =\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()]\n if (typeof segmentPrefetchRSCRequest === 'string') {\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n } else {\n // Otherwise just return without doing anything.\n return false\n }\n\n if (req.url) {\n const parsed = parseUrl(req.url)\n parsed.pathname = parsedUrl.pathname\n req.url = formatUrl(parsed)\n }\n\n return false\n }\n\n private handleNextDataRequest: RouteHandler<ServerRequest, ServerResponse> =\n async (req, res, parsedUrl) => {\n const middleware = await this.getMiddleware()\n const params = matchNextDataPathname(parsedUrl.pathname)\n\n // ignore for non-next data URLs\n if (!params || !params.path) {\n return false\n }\n\n if (params.path[0] !== this.buildId) {\n // Ignore if its a middleware request when we aren't on edge.\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n getRequestMeta(req, 'middlewareInvoke')\n ) {\n return false\n }\n\n // Make sure to 404 if the buildId isn't correct\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // remove buildId from URL\n params.path.shift()\n\n const lastParam = params.path[params.path.length - 1]\n\n // show 404 if it doesn't end with .json\n if (typeof lastParam !== 'string' || !lastParam.endsWith('.json')) {\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // re-create page's pathname\n let pathname = `/${params.path.join('/')}`\n pathname = getRouteFromAssetPath(pathname, '.json')\n\n // ensure trailing slash is normalized per config\n if (middleware) {\n if (this.nextConfig.trailingSlash && !pathname.endsWith('/')) {\n pathname += '/'\n }\n if (\n !this.nextConfig.trailingSlash &&\n pathname.length > 1 &&\n pathname.endsWith('/')\n ) {\n pathname = pathname.substring(0, pathname.length - 1)\n }\n }\n\n if (this.i18nProvider) {\n // Remove the port from the hostname if present.\n const hostname = req?.headers.host?.split(':', 1)[0].toLowerCase()\n\n const domainLocale = this.i18nProvider.detectDomainLocale(hostname)\n const defaultLocale =\n domainLocale?.defaultLocale ?? this.i18nProvider.config.defaultLocale\n\n const localePathResult = this.i18nProvider.analyze(pathname)\n\n // If the locale is detected from the path, we need to remove it\n // from the pathname.\n if (localePathResult.detectedLocale) {\n pathname = localePathResult.pathname\n }\n\n // Update the query with the detected locale and default locale.\n addRequestMeta(req, 'locale', localePathResult.detectedLocale)\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n // If the locale is not detected from the path, we need to mark that\n // it was not inferred from default.\n if (!localePathResult.detectedLocale) {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n\n // If no locale was detected and we don't have middleware, we need\n // to render a 404 page.\n if (!localePathResult.detectedLocale && !middleware) {\n addRequestMeta(req, 'locale', defaultLocale)\n await this.render404(req, res, parsedUrl)\n return true\n }\n }\n\n parsedUrl.pathname = pathname\n addRequestMeta(req, 'isNextDataReq', true)\n\n return false\n }\n\n protected handleNextImageRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallRenderRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallMiddlewareRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected getRouteMatchers(): RouteMatcherManager {\n // Create a new manifest loader that get's the manifests from the server.\n const manifestLoader = new ServerManifestLoader((name) => {\n switch (name) {\n case PAGES_MANIFEST:\n return this.getPagesManifest() ?? null\n case APP_PATHS_MANIFEST:\n return this.getAppPathsManifest() ?? null\n default:\n return null\n }\n })\n\n // Configure the matchers and handlers.\n const matchers: RouteMatcherManager = new DefaultRouteMatcherManager()\n\n // Match pages under `pages/`.\n matchers.push(\n new PagesRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // Match api routes under `pages/api/`.\n matchers.push(\n new PagesAPIRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // If the app directory is enabled, then add the app matchers and handlers.\n if (this.enabledDirectories.app) {\n // Match app pages under `app/`.\n matchers.push(\n new AppPageRouteMatcherProvider(this.distDir, manifestLoader)\n )\n matchers.push(\n new AppRouteRouteMatcherProvider(this.distDir, manifestLoader)\n )\n }\n\n return matchers\n }\n\n protected async instrumentationOnRequestError(\n ...args: Parameters<ServerOnInstrumentationRequestError>\n ) {\n const [err, req, ctx] = args\n\n if (this.instrumentation) {\n try {\n await this.instrumentation.onRequestError?.(\n err,\n {\n path: req.url || '',\n method: req.method || 'GET',\n // Normalize middleware headers and other server request headers\n headers:\n req instanceof NextRequestHint\n ? Object.fromEntries(req.headers.entries())\n : req.headers,\n },\n ctx\n )\n } catch (handlerErr) {\n // Log the soft error and continue, since errors can thrown from react stream handler\n console.error('Error in instrumentation.onRequestError:', handlerErr)\n }\n }\n }\n\n public logError(err: Error): void {\n if (this.quiet) return\n Log.error(err)\n }\n\n public async handleRequest(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise<void> {\n await this.prepare()\n const method = req.method.toUpperCase()\n\n const tracer = getTracer()\n return tracer.withPropagatedContext(req.headers, () => {\n return tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n async (span) =>\n this.handleRequestImpl(req, res, parsedUrl).finally(() => {\n if (!span) return\n\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': isRSCRequest,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) return\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = isRSCRequest\n ? `RSC ${method} ${route}`\n : `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(\n isRSCRequest\n ? `RSC ${method} ${req.url}`\n : `${method} ${req.url}`\n )\n }\n })\n )\n })\n }\n\n private async handleRequestImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise<void> {\n try {\n // Wait for the matchers to be ready.\n await this.matchers.waitTillReady()\n\n // ensure cookies set in middleware are merged and\n // not overridden by API routes/getServerSideProps\n patchSetHeaderWithCookieSupport(\n req,\n isNodeNextResponse(res) ? res.originalResponse : res\n )\n\n const urlParts = (req.url || '').split('?', 1)\n const urlNoQuery = urlParts[0]\n\n // this normalizes repeated slashes in the path e.g. hello//world ->\n // hello/world or backslashes to forward slashes, this does not\n // handle trailing slash as that is handled the same as a next.config.js\n // redirect\n if (urlNoQuery?.match(/(\\\\|\\/\\/)/)) {\n const cleanUrl = normalizeRepeatedSlashes(req.url!)\n res.redirect(cleanUrl, 308).body(cleanUrl).send()\n return\n }\n\n // Parse url if parsedUrl not provided\n if (!parsedUrl || typeof parsedUrl !== 'object') {\n if (!req.url) {\n throw new Error('Invariant: url can not be undefined')\n }\n\n parsedUrl = parseUrl(req.url!, true)\n }\n\n if (!parsedUrl.pathname) {\n throw new Error(\"Invariant: pathname can't be empty\")\n }\n\n // Parse the querystring ourselves if the user doesn't handle querystring parsing\n if (typeof parsedUrl.query === 'string') {\n parsedUrl.query = Object.fromEntries(\n new URLSearchParams(parsedUrl.query)\n )\n }\n\n // Update the `x-forwarded-*` headers.\n const { originalRequest = null } = isNodeNextRequest(req) ? req : {}\n const xForwardedProto = originalRequest?.headers['x-forwarded-proto']\n const isHttps = xForwardedProto\n ? xForwardedProto === 'https'\n : !!(originalRequest?.socket as TLSSocket)?.encrypted\n\n req.headers['x-forwarded-host'] ??= req.headers['host'] ?? this.hostname\n req.headers['x-forwarded-port'] ??= this.port\n ? this.port.toString()\n : isHttps\n ? '443'\n : '80'\n req.headers['x-forwarded-proto'] ??= isHttps ? 'https' : 'http'\n req.headers['x-forwarded-for'] ??= originalRequest?.socket?.remoteAddress\n\n // This should be done before any normalization of the pathname happens as\n // it captures the initial URL.\n this.attachRequestMeta(req, parsedUrl)\n\n let finished = await this.handleRSCRequest(req, res, parsedUrl)\n if (finished) return\n\n const domainLocale = this.i18nProvider?.detectDomainLocale(\n getHostname(parsedUrl, req.headers)\n )\n\n const defaultLocale =\n domainLocale?.defaultLocale || this.nextConfig.i18n?.defaultLocale\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n const url = parseUrlUtil(req.url.replace(/^\\/+/, '/'))\n const pathnameInfo = getNextPathnameInfo(url.pathname, {\n nextConfig: this.nextConfig,\n i18nProvider: this.i18nProvider,\n })\n url.pathname = pathnameInfo.pathname\n\n if (pathnameInfo.basePath) {\n req.url = removePathPrefix(req.url!, this.nextConfig.basePath)\n }\n\n const useMatchedPathHeader =\n this.minimalMode && typeof req.headers[MATCHED_PATH_HEADER] === 'string'\n\n // TODO: merge handling with invokePath\n if (useMatchedPathHeader) {\n try {\n if (this.enabledDirectories.app) {\n // ensure /index path is normalized for prerender\n // in minimal mode\n if (req.url.match(/^\\/index($|\\?)/)) {\n req.url = req.url.replace(/^\\/index/, '/')\n }\n parsedUrl.pathname =\n parsedUrl.pathname === '/index' ? '/' : parsedUrl.pathname\n }\n\n // x-matched-path is the source of truth, it tells what page\n // should be rendered because we don't process rewrites in minimalMode\n let { pathname: matchedPath } = new URL(\n req.headers[MATCHED_PATH_HEADER] as string,\n 'http://localhost'\n )\n\n let { pathname: urlPathname } = new URL(req.url, 'http://localhost')\n\n // For ISR the URL is normalized to the prerenderPath so if\n // it's a data request the URL path will be the data URL,\n // basePath is already stripped by this point\n if (this.normalizers.data?.match(urlPathname)) {\n addRequestMeta(req, 'isNextDataReq', true)\n }\n // In minimal mode, if PPR is enabled, then we should check to see if\n // the request should be a resume request.\n else if (\n this.isAppPPREnabled &&\n this.minimalMode &&\n req.headers[NEXT_RESUME_HEADER] === '1' &&\n req.method === 'POST'\n ) {\n // Decode the postponed state from the request body, it will come as\n // an array of buffers, so collect them and then concat them to form\n // the string.\n const body: Array<Buffer> = []\n for await (const chunk of req.body) {\n body.push(chunk)\n }\n const postponed = Buffer.concat(body).toString('utf8')\n\n addRequestMeta(req, 'postponed', postponed)\n }\n\n matchedPath = this.normalize(matchedPath)\n const normalizedUrlPath = this.stripNextDataPath(urlPathname)\n\n matchedPath = denormalizePagePath(matchedPath)\n\n // Perform locale detection and normalization.\n const localeAnalysisResult = this.i18nProvider?.analyze(matchedPath, {\n defaultLocale,\n })\n\n // The locale result will be defined even if the locale was not\n // detected for the request because it will be inferred from the\n // default locale.\n if (localeAnalysisResult) {\n addRequestMeta(req, 'locale', localeAnalysisResult.detectedLocale)\n\n // If the detected locale was inferred from the default locale, we\n // need to modify the metadata on the request to indicate that.\n if (localeAnalysisResult.inferredFromDefault) {\n addRequestMeta(req, 'localeInferredFromDefault', true)\n } else {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n }\n\n let srcPathname = matchedPath\n let pageIsDynamic = isDynamicRoute(srcPathname)\n let paramsResult: {\n params: ParsedUrlQuery | false\n hasValidParams: boolean\n } = {\n params: false,\n hasValidParams: false,\n }\n\n if (!pageIsDynamic) {\n const match = await this.matchers.match(srcPathname, {\n i18n: localeAnalysisResult,\n })\n\n // Update the source pathname to the matched page's pathname.\n if (match) {\n srcPathname = match.definition.pathname\n\n // The page is dynamic if the params are defined. We know at this\n // stage that the matched path is not a static page if the params\n // were parsed from the matched path header.\n if (typeof match.params !== 'undefined') {\n pageIsDynamic = true\n paramsResult.params = match.params\n paramsResult.hasValidParams = true\n }\n }\n }\n\n // The rest of this function can't handle i18n properly, so ensure we\n // restore the pathname with the locale information stripped from it\n // now that we're done matching if we're using i18n.\n if (localeAnalysisResult) {\n matchedPath = localeAnalysisResult.pathname\n }\n\n const utils = getUtils({\n pageIsDynamic,\n page: srcPathname,\n i18n: this.nextConfig.i18n,\n basePath: this.nextConfig.basePath,\n rewrites: this.getRoutesManifest()?.rewrites || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n caseSensitive: !!this.nextConfig.experimental.caseSensitiveRoutes,\n })\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !pathnameInfo.locale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname}`\n }\n\n // Store a copy of `parsedUrl.query` before calling handleRewrites.\n // Since `handleRewrites` might add new queries to `parsedUrl.query`.\n const originQueryParams = { ...parsedUrl.query }\n\n const pathnameBeforeRewrite = parsedUrl.pathname\n const rewriteParamKeys = Object.keys(\n utils.handleRewrites(req, parsedUrl)\n )\n\n // Create a copy of the query params to avoid mutating the original\n // object. This prevents any overlapping query params that have the\n // same normalized key from causing issues.\n const queryParams = { ...parsedUrl.query }\n const didRewrite = pathnameBeforeRewrite !== parsedUrl.pathname\n\n if (didRewrite && parsedUrl.pathname) {\n addRequestMeta(req, 'rewroteURL', parsedUrl.pathname)\n }\n\n const routeParamKeys = new Set<string>()\n for (const [key, value] of Object.entries(parsedUrl.query)) {\n const normalizedKey = normalizeNextQueryParam(key)\n if (!normalizedKey) continue\n\n // Remove the prefixed key from the query params because we want\n // to consume it for the dynamic route matcher.\n delete parsedUrl.query[key]\n routeParamKeys.add(normalizedKey)\n\n if (typeof value === 'undefined') continue\n\n queryParams[normalizedKey] = Array.isArray(value)\n ? value.map((v) => decodeQueryPathParameter(v))\n : decodeQueryPathParameter(value)\n }\n\n // interpolate dynamic params and normalize URL if needed\n if (pageIsDynamic) {\n let params: ParsedUrlQuery | false = {}\n\n // ensure we normalize the dynamic route params for encoding/\n // default values\n paramsResult = utils.normalizeDynamicRouteParams(queryParams, false)\n\n // for prerendered ISR paths we attempt parsing the route\n // params from the URL directly as route-matches may not\n // contain the correct values due to the filesystem path\n // matching before the dynamic route has been matched\n if (\n !paramsResult.hasValidParams &&\n !isDynamicRoute(normalizedUrlPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(normalizedUrlPath)\n\n if (matcherParams) {\n utils.normalizeDynamicRouteParams(matcherParams, false)\n Object.assign(paramsResult.params, matcherParams)\n paramsResult.hasValidParams = true\n }\n }\n\n // if an action request is bypassing a prerender and we\n // don't have the params in the URL since it was prerendered\n // and matched during handle: 'filesystem' rather than dynamic route\n // resolving we need to parse the params from the matched-path.\n // Note: this is similar to above case but from match-path instead\n // of from the request URL since a rewrite could cause that to not\n // match the src pathname\n if (\n // we can have a collision with /index and a top-level /[slug]\n matchedPath !== '/index' &&\n !paramsResult.hasValidParams &&\n !isDynamicRoute(matchedPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(matchedPath)\n\n if (matcherParams) {\n const curParamsResult = utils.normalizeDynamicRouteParams(\n matcherParams,\n false\n )\n\n if (curParamsResult.hasValidParams) {\n Object.assign(params, matcherParams)\n paramsResult = curParamsResult\n }\n }\n }\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n\n const routeMatchesHeader = req.headers['x-now-route-matches']\n if (\n typeof routeMatchesHeader === 'string' &&\n routeMatchesHeader &&\n isDynamicRoute(matchedPath) &&\n !paramsResult.hasValidParams\n ) {\n const routeMatches =\n utils.getParamsFromRouteMatches(routeMatchesHeader)\n\n if (routeMatches) {\n paramsResult = utils.normalizeDynamicRouteParams(\n routeMatches,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n }\n\n // Try to parse the params from the query if we couldn't parse them\n // from the route matches but ignore missing optional params.\n if (!paramsResult.hasValidParams) {\n paramsResult = utils.normalizeDynamicRouteParams(\n queryParams,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // handle the actual dynamic route name being requested\n if (\n utils.defaultRouteMatches &&\n normalizedUrlPath === srcPathname &&\n !paramsResult.hasValidParams &&\n !utils.normalizeDynamicRouteParams({ ...params }, true)\n .hasValidParams\n ) {\n params = utils.defaultRouteMatches\n\n // Mark that the default route matches were set on the request\n // during routing.\n addRequestMeta(req, 'didSetDefaultRouteMatches', true)\n }\n\n if (params) {\n matchedPath = utils.interpolateDynamicPath(srcPathname, params)\n req.url = utils.interpolateDynamicPath(req.url!, params)\n\n // If the request is for a segment prefetch, we need to update the\n // segment prefetch request path to include the interpolated\n // params.\n let segmentPrefetchRSCRequest = getRequestMeta(\n req,\n 'segmentPrefetchRSCRequest'\n )\n if (\n segmentPrefetchRSCRequest &&\n isDynamicRoute(segmentPrefetchRSCRequest, false)\n ) {\n segmentPrefetchRSCRequest = utils.interpolateDynamicPath(\n segmentPrefetchRSCRequest,\n params\n )\n\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()] =\n segmentPrefetchRSCRequest\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n }\n\n if (pageIsDynamic || didRewrite) {\n utils.normalizeCdnUrl(req, [\n ...rewriteParamKeys,\n ...Object.keys(utils.defaultRouteRegex?.groups || {}),\n ])\n }\n // Remove the route `params` keys from `parsedUrl.query` if they are\n // not in the original query params.\n // If it's used in both route `params` and query `searchParams`, it should be kept.\n for (const key of routeParamKeys) {\n if (!(key in originQueryParams)) {\n delete parsedUrl.query[key]\n }\n }\n parsedUrl.pathname = matchedPath\n url.pathname = parsedUrl.pathname\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n } catch (err) {\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n throw err\n }\n }\n\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n\n if (pathnameInfo.locale) {\n req.url = formatUrl(url)\n addRequestMeta(req, 'didStripLocale', true)\n }\n\n // If we aren't in minimal mode or there is no locale in the query\n // string, add the locale to the query string.\n if (!this.minimalMode || !getRequestMeta(req, 'locale')) {\n // If the locale is in the pathname, add it to the query string.\n if (pathnameInfo.locale) {\n addRequestMeta(req, 'locale', pathnameInfo.locale)\n }\n // If the default locale is available, add it to the query string and\n // mark it as inferred rather than implicit.\n else if (defaultLocale) {\n addRequestMeta(req, 'locale', defaultLocale)\n addRequestMeta(req, 'localeInferredFromDefault', true)\n }\n }\n\n // set incremental cache to request meta so it can\n // be passed down for edge functions and the fetch disk\n // cache can be leveraged locally\n if (\n !(this.serverOptions as any).webServerConfig &&\n !getRequestMeta(req, 'incrementalCache')\n ) {\n let protocol: 'http:' | 'https:' = 'https:'\n\n try {\n const parsedFullUrl = new URL(\n getRequestMeta(req, 'initURL') || '/',\n 'http://n'\n )\n protocol = parsedFullUrl.protocol as 'https:' | 'http:'\n } catch {}\n\n const incrementalCache = await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n requestProtocol: protocol.substring(0, protocol.length - 1) as\n | 'http'\n | 'https',\n })\n\n incrementalCache.resetRequestCache()\n addRequestMeta(req, 'incrementalCache', incrementalCache)\n ;(globalThis as any).__incrementalCache = incrementalCache\n }\n\n const cacheHandlers = getCacheHandlers()\n\n if (cacheHandlers) {\n await Promise.all(\n [...cacheHandlers].map(async (cacheHandler) => {\n if ('refreshTags' in cacheHandler) {\n // Note: cacheHandler.refreshTags() is called lazily before the\n // first cache entry is retrieved. It allows us to skip the\n // refresh request if no caches are read at all.\n } else {\n const previouslyRevalidatedTags = getPreviouslyRevalidatedTags(\n req.headers,\n this.getPrerenderManifest().preview.previewModeId\n )\n\n await cacheHandler.receiveExpiredTags(\n ...previouslyRevalidatedTags\n )\n }\n })\n )\n }\n\n // set server components HMR cache to request meta so it can be passed\n // down for edge functions\n if (!getRequestMeta(req, 'serverComponentsHmrCache')) {\n addRequestMeta(\n req,\n 'serverComponentsHmrCache',\n this.getServerComponentsHmrCache()\n )\n }\n\n // when invokePath is specified we can short short circuit resolving\n // we only honor this header if we are inside of a render worker to\n // prevent external users coercing the routing path\n const invokePath = getRequestMeta(req, 'invokePath')\n const useInvokePath =\n !useMatchedPathHeader &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n invokePath\n\n if (useInvokePath) {\n const invokeStatus = getRequestMeta(req, 'invokeStatus')\n if (invokeStatus) {\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n res.statusCode = invokeStatus\n let err: Error | null = getRequestMeta(req, 'invokeError') || null\n\n return this.renderError(err, req, res, '/_error', parsedUrl.query)\n }\n\n const parsedMatchedPath = new URL(invokePath || '/', 'http://n')\n const invokePathnameInfo = getNextPathnameInfo(\n parsedMatchedPath.pathname,\n {\n nextConfig: this.nextConfig,\n parseData: false,\n }\n )\n\n if (invokePathnameInfo.locale) {\n addRequestMeta(req, 'locale', invokePathnameInfo.locale)\n }\n\n if (parsedUrl.pathname !== parsedMatchedPath.pathname) {\n parsedUrl.pathname = parsedMatchedPath.pathname\n addRequestMeta(req, 'rewroteURL', invokePathnameInfo.pathname)\n }\n const normalizeResult = normalizeLocalePath(\n removePathPrefix(parsedUrl.pathname, this.nextConfig.basePath || ''),\n this.nextConfig.i18n?.locales\n )\n\n if (normalizeResult.detectedLocale) {\n addRequestMeta(req, 'locale', normalizeResult.detectedLocale)\n }\n parsedUrl.pathname = normalizeResult.pathname\n\n for (const key of Object.keys(parsedUrl.query)) {\n delete parsedUrl.query[key]\n }\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n return\n }\n\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n getRequestMeta(req, 'middlewareInvoke')\n ) {\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n finished = await this.handleCatchallMiddlewareRequest(\n req,\n res,\n parsedUrl\n )\n if (finished) return\n\n const err = new Error()\n ;(err as any).result = {\n response: new Response(null, {\n headers: {\n 'x-middleware-next': '1',\n },\n }),\n }\n ;(err as any).bubble = true\n throw err\n }\n\n // This wasn't a request via the matched path or the invoke path, so\n // prepare for a legacy run by removing the base path.\n\n // ensure we strip the basePath when not using an invoke header\n if (!useMatchedPathHeader && pathnameInfo.basePath) {\n parsedUrl.pathname = removePathPrefix(\n parsedUrl.pathname,\n pathnameInfo.basePath\n )\n }\n\n res.statusCode = 200\n return await this.run(req, res, parsedUrl)\n } catch (err: any) {\n if (err instanceof NoFallbackError) {\n throw err\n }\n\n if (\n (err && typeof err === 'object' && err.code === 'ERR_INVALID_URL') ||\n err instanceof DecodeError ||\n err instanceof NormalizeError\n ) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n\n if (\n this.minimalMode ||\n this.renderOpts.dev ||\n (isBubbledError(err) && err.bubble)\n ) {\n throw err\n }\n this.logError(getProperError(err))\n res.statusCode = 500\n res.body('Internal Server Error').send()\n }\n }\n\n /**\n * Normalizes a pathname without attaching any metadata from any matched\n * normalizer.\n *\n * @param pathname the pathname to normalize\n * @returns the normalized pathname\n */\n private normalize = (pathname: string) => {\n const normalizers: Array<PathnameNormalizer> = []\n\n if (this.normalizers.data) {\n normalizers.push(this.normalizers.data)\n }\n\n // We have to put the segment prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.segmentPrefetchRSC) {\n normalizers.push(this.normalizers.segmentPrefetchRSC)\n }\n\n // We have to put the prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.prefetchRSC) {\n normalizers.push(this.normalizers.prefetchRSC)\n }\n\n if (this.normalizers.rsc) {\n normalizers.push(this.normalizers.rsc)\n }\n\n for (const normalizer of normalizers) {\n if (!normalizer.match(pathname)) continue\n\n return normalizer.normalize(pathname, true)\n }\n\n return pathname\n }\n\n private normalizeAndAttachMetadata: RouteHandler<\n ServerRequest,\n ServerResponse\n > = async (req, res, url) => {\n let finished = await this.handleNextImageRequest(req, res, url)\n if (finished) return true\n\n if (this.enabledDirectories.pages) {\n finished = await this.handleNextDataRequest(req, res, url)\n if (finished) return true\n }\n\n return false\n }\n\n /**\n * @internal - this method is internal to Next.js and should not be used directly by end-users\n */\n public getRequestHandlerWithMetadata(\n meta: RequestMeta\n ): BaseRequestHandler<ServerRequest, ServerResponse> {\n const handler = this.getRequestHandler()\n return (req, res, parsedUrl) => {\n setRequestMeta(req, meta)\n return handler(req, res, parsedUrl)\n }\n }\n\n public getRequestHandler(): BaseRequestHandler<\n ServerRequest,\n ServerResponse\n > {\n return this.handleRequest.bind(this)\n }\n\n protected abstract handleUpgrade(\n req: ServerRequest,\n socket: any,\n head?: any\n ): Promise<void>\n\n public setAssetPrefix(prefix?: string): void {\n this.renderOpts.assetPrefix = prefix ? prefix.replace(/\\/$/, '') : ''\n }\n\n protected prepared: boolean = false\n protected preparedPromise: Promise<void> | null = null\n /**\n * Runs async initialization of server.\n * It is idempotent, won't fire underlying initialization more than once.\n */\n public async prepare(): Promise<void> {\n if (this.prepared) return\n\n if (this.preparedPromise === null) {\n // Get instrumentation module\n this.instrumentation = await this.loadInstrumentationModule()\n this.preparedPromise = this.prepareImpl().then(() => {\n this.prepared = true\n this.preparedPromise = null\n })\n }\n return this.preparedPromise\n }\n protected async prepareImpl(): Promise<void> {}\n protected async loadInstrumentationModule(): Promise<any> {}\n\n public async close(): Promise<void> {}\n\n protected getAppPathRoutes(): Record<string, string[]> {\n const appPathRoutes: Record<string, string[]> = {}\n\n Object.keys(this.appPathsManifest || {}).forEach((entry) => {\n const normalizedPath = normalizeAppPath(entry)\n if (!appPathRoutes[normalizedPath]) {\n appPathRoutes[normalizedPath] = []\n }\n appPathRoutes[normalizedPath].push(entry)\n })\n return appPathRoutes\n }\n\n protected async run(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.run, async () =>\n this.runImpl(req, res, parsedUrl)\n )\n }\n\n private async runImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise<void> {\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n }\n\n private async pipe(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.pipe, async () =>\n this.pipeImpl(fn, partialContext)\n )\n }\n\n private async pipeImpl(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<void> {\n const ua = partialContext.req.headers['user-agent'] || ''\n\n const ctx: RequestContext<ServerRequest, ServerResponse> = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n // `renderOpts.botType` is accumulated in `this.renderImpl()`\n supportsDynamicResponse: !this.renderOpts.botType,\n serveStreamingMetadata: shouldServeStreamingMetadata(\n ua,\n this.nextConfig.htmlLimitedBots\n ),\n },\n }\n\n const payload = await fn(ctx)\n if (payload === null) {\n return\n }\n const { req, res } = ctx\n const originalStatus = res.statusCode\n const { body, type } = payload\n let { cacheControl } = payload\n if (!res.sent) {\n const { generateEtags, poweredByHeader, dev } = this.renderOpts\n\n // In dev, we should not cache pages for any reason.\n if (dev) {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n cacheControl = undefined\n }\n\n if (cacheControl && cacheControl.expire === undefined) {\n cacheControl.expire = this.nextConfig.expireTime\n }\n\n await this.sendRenderResult(req, res, {\n result: body,\n type,\n generateEtags,\n poweredByHeader,\n cacheControl,\n })\n res.statusCode = originalStatus\n }\n }\n\n private async getStaticHTML(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<string | null> {\n const ctx: RequestContext<ServerRequest, ServerResponse> = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n supportsDynamicResponse: false,\n },\n }\n const payload = await fn(ctx)\n if (payload === null) {\n return null\n }\n return payload.body.toUnchunkedString()\n }\n\n public async render(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.render, async () =>\n this.renderImpl(req, res, pathname, query, parsedUrl, internalRender)\n )\n }\n\n protected getWaitUntil(): WaitUntil | undefined {\n const builtinRequestContext = getBuiltinRequestContext()\n if (builtinRequestContext) {\n // the platform provided a request context.\n // use the `waitUntil` from there, whether actually present or not --\n // if not present, `after` will error.\n\n // NOTE: if we're in an edge runtime sandbox, this context will be used to forward the outer waitUntil.\n return builtinRequestContext.waitUntil\n }\n\n if (this.minimalMode) {\n // we're built for a serverless environment, and `waitUntil` is not available,\n // but using a noop would likely lead to incorrect behavior,\n // because we have no way of keeping the invocation alive.\n // return nothing, and `after` will error if used.\n //\n // NOTE: for edge functions, `NextWebServer` always runs in minimal mode.\n //\n // NOTE: if we're in an edge runtime sandbox, waitUntil will be passed in using \"@next/request-context\",\n // so we won't get here.\n return undefined\n }\n\n return this.getInternalWaitUntil()\n }\n\n protected getInternalWaitUntil(): WaitUntil | undefined {\n return undefined\n }\n\n private async renderImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise<void> {\n if (!pathname.startsWith('/')) {\n console.warn(\n `Cannot render page with path \"${pathname}\", did you mean \"/${pathname}\"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`\n )\n }\n\n if (\n this.serverOptions.customServer &&\n pathname === '/index' &&\n !(await this.hasPage('/index'))\n ) {\n // maintain backwards compatibility for custom server\n // (see custom-server integration tests)\n pathname = '/'\n }\n\n const ua = req.headers['user-agent'] || ''\n this.renderOpts.botType = getBotType(ua)\n\n // we allow custom servers to call render for all URLs\n // so check if we need to serve a static _next file or not.\n // we don't modify the URL for _next/data request but still\n // call render so we special case this to prevent an infinite loop\n if (\n !internalRender &&\n !this.minimalMode &&\n !getRequestMeta(req, 'isNextDataReq') &&\n (req.url?.match(/^\\/_next\\//) ||\n (this.hasStaticDir && req.url!.match(/^\\/static\\//)))\n ) {\n return this.handleRequest(req, res, parsedUrl)\n }\n\n if (isBlockedPage(pathname)) {\n return this.render404(req, res, parsedUrl)\n }\n\n return this.pipe((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n protected async getStaticPaths({\n pathname,\n }: {\n pathname: string\n requestHeaders: import('./lib/incremental-cache').IncrementalCache['requestHeaders']\n page: string\n isAppPath: boolean\n }): Promise<{\n staticPaths?: string[]\n fallbackMode?: FallbackMode\n }> {\n // Read whether or not fallback should exist from the manifest.\n const fallbackField =\n this.getPrerenderManifest().dynamicRoutes[pathname]?.fallback\n\n return {\n // `staticPaths` is intentionally set to `undefined` as it should've\n // been caught when checking disk data.\n staticPaths: undefined,\n fallbackMode: parseFallbackField(fallbackField),\n }\n }\n\n private async renderToResponseWithComponents(\n requestContext: RequestContext<ServerRequest, ServerResponse>,\n findComponentsResult: FindComponentsResult\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(\n BaseServerSpan.renderToResponseWithComponents,\n async () =>\n this.renderToResponseWithComponentsImpl(\n requestContext,\n findComponentsResult\n )\n )\n }\n\n protected pathCouldBeIntercepted(resolvedPathname: string): boolean {\n return (\n isInterceptionRouteAppPath(resolvedPathname) ||\n this.interceptionRoutePatterns.some((regexp) => {\n return regexp.test(resolvedPathname)\n })\n )\n }\n\n protected setVaryHeader(\n req: ServerRequest,\n res: ServerResponse,\n isAppPath: boolean,\n resolvedPathname: string\n ): void {\n let addedNextUrlToVary = false\n\n if (isAppPath && this.pathCouldBeIntercepted(resolvedPathname)) {\n // Interception route responses can vary based on the `Next-URL` header.\n // We use the Vary header to signal this behavior to the client to properly cache the response.\n res.appendHeader('vary', `${NEXT_URL}`)\n addedNextUrlToVary = true\n }\n // For other cases such as App Router requests or RSC requests we don't need to set vary header since we already\n // have the _rsc query with the unique hash value.\n\n if (!addedNextUrlToVary) {\n // Remove `Next-URL` from the request headers we determined it wasn't necessary to include in the Vary header.\n // This is to avoid any dependency on the `Next-URL` header being present when preparing the response.\n delete req.headers[NEXT_URL]\n }\n }\n\n private async renderToResponseWithComponentsImpl(\n {\n req,\n res,\n pathname,\n renderOpts: opts,\n }: RequestContext<ServerRequest, ServerResponse>,\n { components, query }: FindComponentsResult\n ): Promise<ResponsePayload | null> {\n if (pathname === UNDERSCORE_NOT_FOUND_ROUTE) {\n pathname = '/404'\n }\n const isErrorPathname = pathname === '/_error'\n const is404Page =\n pathname === '/404' || (isErrorPathname && res.statusCode === 404)\n const is500Page =\n pathname === '/500' || (isErrorPathname && res.statusCode === 500)\n const isAppPath = components.isAppPath === true\n\n const hasServerProps = !!components.getServerSideProps\n let hasGetStaticPaths = !!components.getStaticPaths\n const isPossibleServerAction = getIsPossibleServerAction(req)\n const hasGetInitialProps = !!components.Component?.getInitialProps\n let isSSG = !!components.getStaticProps\n\n // Compute the iSSG cache key. We use the rewroteUrl since\n // pages with fallback: false are allowed to be rewritten to\n // and we need to look up the path by the rewritten path\n let urlPathname = parseUrl(req.url || '').pathname || '/'\n\n let resolvedUrlPathname = getRequestMeta(req, 'rewroteURL') || urlPathname\n\n this.setVaryHeader(req, res, isAppPath, resolvedUrlPathname)\n\n let staticPaths: string[] | undefined\n let fallbackMode: FallbackMode | undefined\n let hasFallback = false\n\n const isDynamic = isDynamicRoute(components.page)\n\n const prerenderManifest = this.getPrerenderManifest()\n\n if (isAppPath && isDynamic) {\n const pathsResult = await this.getStaticPaths({\n pathname,\n page: components.page,\n isAppPath,\n requestHeaders: req.headers,\n })\n\n staticPaths = pathsResult.staticPaths\n fallbackMode = pathsResult.fallbackMode\n hasFallback = typeof fallbackMode !== 'undefined'\n\n if (this.nextConfig.output === 'export') {\n const page = components.page\n if (!staticPaths) {\n throw new Error(\n `Page \"${page}\" is missing exported function \"generateStaticParams()\", which is required with \"output: export\" config.`\n )\n }\n\n const resolvedWithoutSlash = removeTrailingSlash(resolvedUrlPathname)\n if (!staticPaths.includes(resolvedWithoutSlash)) {\n throw new Error(\n `Page \"${page}\" is missing param \"${resolvedWithoutSlash}\" in \"generateStaticParams()\", which is required with \"output: export\" config.`\n )\n }\n }\n\n if (hasFallback) {\n hasGetStaticPaths = true\n }\n }\n\n if (\n hasFallback ||\n staticPaths?.includes(resolvedUrlPathname) ||\n // this signals revalidation in deploy environments\n // TODO: make this more generic\n req.headers['x-now-route-matches']\n ) {\n isSSG = true\n } else if (!this.renderOpts.dev) {\n isSSG ||= !!prerenderManifest.routes[toRoute(pathname)]\n }\n\n // Toggle whether or not this is a Data request\n const isNextDataRequest =\n !!(\n getRequestMeta(req, 'isNextDataReq') ||\n (req.headers['x-nextjs-data'] &&\n (this.serverOptions as any).webServerConfig)\n ) &&\n (isSSG || hasServerProps)\n\n /**\n * If true, this indicates that the request being made is for an app\n * prefetch request.\n */\n const isPrefetchRSCRequest =\n getRequestMeta(req, 'isPrefetchRSCRequest') ?? false\n\n // NOTE: Don't delete headers[RSC] yet, it still needs to be used in renderToHTML later\n\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n\n // when we are handling a middleware prefetch and it doesn't\n // resolve to a static data route we bail early to avoid\n // unexpected SSR invocations\n if (\n !isSSG &&\n req.headers['x-middleware-prefetch'] &&\n !(is404Page || pathname === '/_error')\n ) {\n res.setHeader(MATCHED_PATH_HEADER, pathname)\n res.setHeader('x-middleware-skip', '1')\n res.setHeader(\n 'cache-control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n res.body('{}').send()\n return null\n }\n\n // normalize req.url for SSG paths as it is not exposed\n // to getStaticProps and the asPath should not expose /_next/data\n if (\n isSSG &&\n this.minimalMode &&\n req.headers[MATCHED_PATH_HEADER] &&\n req.url.startsWith('/_next/data')\n ) {\n req.url = this.stripNextDataPath(req.url)\n }\n\n const locale = getRequestMeta(req, 'locale')\n const defaultLocale = isSSG\n ? this.nextConfig.i18n?.defaultLocale\n : getRequestMeta(req, 'defaultLocale')\n\n if (\n !!req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n }\n\n let routeModule: RouteModule | undefined\n if (components.routeModule) {\n routeModule = components.routeModule\n }\n\n /**\n * If the route being rendered is an app page, and the ppr feature has been\n * enabled, then the given route _could_ support PPR.\n */\n const couldSupportPPR: boolean =\n this.isAppPPREnabled &&\n typeof routeModule !== 'undefined' &&\n isAppPageRouteModule(routeModule)\n\n // When enabled, this will allow the use of the `?__nextppronly` query to\n // enable debugging of the static shell.\n const hasDebugStaticShellQuery =\n process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1' &&\n typeof query.__nextppronly !== 'undefined' &&\n couldSupportPPR\n\n // When enabled, this will allow the use of the `?__nextppronly` query\n // to enable debugging of the fallback shell.\n const hasDebugFallbackShellQuery =\n hasDebugStaticShellQuery && query.__nextppronly === 'fallback'\n\n // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the\n // prerender manifest and this is an app page.\n const isRoutePPREnabled: boolean =\n couldSupportPPR &&\n ((\n prerenderManifest.routes[pathname] ??\n prerenderManifest.dynamicRoutes[pathname]\n )?.renderingMode === 'PARTIALLY_STATIC' ||\n // Ideally we'd want to check the appConfig to see if this page has PPR\n // enabled or not, but that would require plumbing the appConfig through\n // to the server during development. We assume that the page supports it\n // but only during development.\n (hasDebugStaticShellQuery &&\n (this.renderOpts.dev === true ||\n this.experimentalTestProxy === true)))\n\n const isDebugStaticShell: boolean =\n hasDebugStaticShellQuery && isRoutePPREnabled\n\n // We should enable debugging dynamic accesses when the static shell\n // debugging has been enabled and we're also in development mode.\n const isDebugDynamicAccesses =\n isDebugStaticShell && this.renderOpts.dev === true\n\n const isDebugFallbackShell = hasDebugFallbackShellQuery && isRoutePPREnabled\n\n // If we're in minimal mode, then try to get the postponed information from\n // the request metadata. If available, use it for resuming the postponed\n // render.\n const minimalPostponed = isRoutePPREnabled\n ? getRequestMeta(req, 'postponed')\n : undefined\n\n // If PPR is enabled, and this is a RSC request (but not a prefetch), then\n // we can use this fact to only generate the flight data for the request\n // because we can't cache the HTML (as it's also dynamic).\n const isDynamicRSCRequest =\n isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest\n\n // Need to read this before it's stripped by stripFlightHeaders. We don't\n // need to transfer it to the request meta because it's only read\n // within this function; the static segment data should have already been\n // generated, so we will always either return a static response or a 404.\n const segmentPrefetchHeader = getRequestMeta(\n req,\n 'segmentPrefetchRSCRequest'\n )\n\n const isHtmlBot = isHtmlBotRequest(req)\n if (isHtmlBot && isRoutePPREnabled) {\n isSSG = false\n this.renderOpts.serveStreamingMetadata = false\n }\n\n // we need to ensure the status code if /404 is visited directly\n if (is404Page && !isNextDataRequest && !isRSCRequest) {\n res.statusCode = 404\n }\n\n // ensure correct status is set when visiting a status page\n // directly e.g. /500\n if (STATIC_STATUS_PAGES.includes(pathname)) {\n res.statusCode = parseInt(pathname.slice(1), 10)\n }\n\n if (\n // Server actions can use non-GET/HEAD methods.\n !isPossibleServerAction &&\n // Resume can use non-GET/HEAD methods.\n !minimalPostponed &&\n !is404Page &&\n !is500Page &&\n pathname !== '/_error' &&\n req.method !== 'HEAD' &&\n req.method !== 'GET' &&\n (typeof components.Component === 'string' || isSSG)\n ) {\n res.statusCode = 405\n res.setHeader('Allow', ['GET', 'HEAD'])\n res.body('Method Not Allowed').send()\n return null\n }\n\n // handle static page\n if (typeof components.Component === 'string') {\n return {\n type: 'html',\n // TODO: Static pages should be serialized as RenderResult\n body: RenderResult.fromStatic(components.Component),\n }\n }\n\n // Ensure that if the `amp` query parameter is falsy that we remove it from\n // the query object. This ensures it won't be found by the `in` operator.\n if ('amp' in query && !query.amp) delete query.amp\n\n if (opts.supportsDynamicResponse === true) {\n const ua = req.headers['user-agent'] || ''\n const isBotRequest = isBot(ua)\n const isSupportedDocument =\n typeof components.Document?.getInitialProps !== 'function' ||\n // The built-in `Document` component also supports dynamic HTML for concurrent mode.\n NEXT_BUILTIN_DOCUMENT in components.Document\n\n // Disable dynamic HTML in cases that we know it won't be generated,\n // so that we can continue generating a cache key when possible.\n // TODO-APP: should the first render for a dynamic app path\n // be static so we can collect revalidate and populate the\n // cache if there are no dynamic data requirements\n opts.supportsDynamicResponse =\n !isSSG && !isBotRequest && !query.amp && isSupportedDocument\n }\n\n // In development, we always want to generate dynamic HTML.\n if (!isNextDataRequest && isAppPath && opts.dev) {\n opts.supportsDynamicResponse = true\n }\n\n const locales = this.nextConfig.i18n?.locales\n\n let previewData: PreviewData\n let isPreviewMode = false\n\n if (hasServerProps || isSSG || isAppPath) {\n // For the edge runtime, we don't support preview mode in SSG.\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { tryGetPreviewData } =\n require('./api-utils/node/try-get-preview-data') as typeof import('./api-utils/node/try-get-preview-data')\n previewData = tryGetPreviewData(\n req,\n res,\n this.renderOpts.previewProps,\n !!this.nextConfig.experimental.multiZoneDraftMode\n )\n isPreviewMode = previewData !== false\n }\n }\n\n // If this is a request for an app path that should be statically generated\n // and we aren't in the edge runtime, strip the flight headers so it will\n // generate the static response.\n if (\n isAppPath &&\n !opts.dev &&\n !isPreviewMode &&\n isSSG &&\n isRSCRequest &&\n !isDynamicRSCRequest &&\n (!isEdgeRuntime(opts.runtime) ||\n (this.serverOptions as any).webServerConfig)\n ) {\n stripFlightHeaders(req.headers)\n }\n\n let { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, this.renderOpts.previewProps)\n\n if (isSSG && this.minimalMode && req.headers[MATCHED_PATH_HEADER]) {\n // the url value is already correct when the matched-path header is set\n resolvedUrlPathname = urlPathname\n }\n\n urlPathname = removeTrailingSlash(urlPathname)\n resolvedUrlPathname = removeTrailingSlash(resolvedUrlPathname)\n if (this.localeNormalizer) {\n resolvedUrlPathname = this.localeNormalizer.normalize(resolvedUrlPathname)\n }\n\n const handleRedirect = (pageData: any) => {\n const redirect = {\n destination: pageData.pageProps.__N_REDIRECT,\n statusCode: pageData.pageProps.__N_REDIRECT_STATUS,\n basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH,\n }\n const statusCode = getRedirectStatus(redirect)\n const { basePath } = this.nextConfig\n\n if (\n basePath &&\n redirect.basePath !== false &&\n redirect.destination.startsWith('/')\n ) {\n redirect.destination = `${basePath}${redirect.destination}`\n }\n\n if (redirect.destination.startsWith('/')) {\n redirect.destination = normalizeRepeatedSlashes(redirect.destination)\n }\n\n res\n .redirect(redirect.destination, statusCode)\n .body(redirect.destination)\n .send()\n }\n\n // remove /_next/data prefix from urlPathname so it matches\n // for direct page visit and /_next/data visit\n if (isNextDataRequest) {\n resolvedUrlPathname = this.stripNextDataPath(resolvedUrlPathname)\n urlPathname = this.stripNextDataPath(urlPathname)\n }\n\n let ssgCacheKey: string | null = null\n if (\n !isPreviewMode &&\n isSSG &&\n !opts.supportsDynamicResponse &&\n !isPossibleServerAction &&\n !minimalPostponed &&\n !isDynamicRSCRequest\n ) {\n ssgCacheKey = `${locale ? `/${locale}` : ''}${\n (pathname === '/' || resolvedUrlPathname === '/') && locale\n ? ''\n : resolvedUrlPathname\n }${query.amp ? '.amp' : ''}`\n }\n\n if ((is404Page || is500Page) && isSSG) {\n ssgCacheKey = `${locale ? `/${locale}` : ''}${pathname}${\n query.amp ? '.amp' : ''\n }`\n }\n\n if (ssgCacheKey) {\n ssgCacheKey = decodePathParams(ssgCacheKey)\n\n // ensure /index and / is normalized to one key\n ssgCacheKey =\n ssgCacheKey === '/index' && pathname === '/' ? '/' : ssgCacheKey\n }\n let protocol: 'http:' | 'https:' = 'https:'\n\n try {\n const parsedFullUrl = new URL(\n getRequestMeta(req, 'initURL') || '/',\n 'http://n'\n )\n protocol = parsedFullUrl.protocol as 'https:' | 'http:'\n } catch {}\n\n // use existing incrementalCache instance if available\n const incrementalCache: import('./lib/incremental-cache').IncrementalCache =\n (globalThis as any).__incrementalCache ||\n (await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n requestProtocol: protocol.substring(0, protocol.length - 1) as\n | 'http'\n | 'https',\n }))\n\n // TODO: investigate, this is not safe across multiple concurrent requests\n incrementalCache.resetRequestCache()\n\n type RendererContext = {\n /**\n * The postponed data for this render. This is only provided when resuming\n * a render that has been postponed.\n */\n postponed: string | undefined\n\n pagesFallback: boolean | undefined\n\n /**\n * The unknown route params for this render.\n */\n fallbackRouteParams: FallbackRouteParams | null\n }\n type Renderer = (\n context: RendererContext\n ) => Promise<ResponseCacheEntry | null>\n\n const doRender: Renderer = async ({\n postponed,\n pagesFallback = false,\n fallbackRouteParams,\n }) => {\n // In development, we always want to generate dynamic HTML.\n let supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML, unless it's\n // a data request, in which case we only produce static HTML.\n (!isNextDataRequest && opts.dev === true) ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n (!isSSG && !hasGetStaticPaths) ||\n // If this request has provided postponed data, it supports dynamic\n // HTML.\n typeof postponed === 'string' ||\n // If this is a dynamic RSC request, then this render supports dynamic\n // HTML (it's dynamic).\n isDynamicRSCRequest\n\n const origQuery = parseUrl(req.url || '', true).query\n\n // clear any dynamic route params so they aren't in\n // the resolvedUrl\n if (opts.params) {\n Object.keys(opts.params).forEach((key) => {\n delete origQuery[key]\n })\n }\n const hadTrailingSlash =\n urlPathname !== '/' && this.nextConfig.trailingSlash\n\n const resolvedUrl = formatUrl({\n pathname: `${resolvedUrlPathname}${hadTrailingSlash ? '/' : ''}`,\n // make sure to only add query values from original URL\n query: origQuery,\n })\n\n // When html bots request PPR page, perform the full dynamic rendering.\n const shouldWaitOnAllReady = isHtmlBot && isRoutePPREnabled\n\n const renderOpts: LoadedRenderOpts = {\n ...components,\n ...opts,\n ...(isAppPath\n ? {\n incrementalCache,\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,\n serverActions: this.nextConfig.experimental.serverActions,\n }\n : {}),\n isNextDataRequest,\n resolvedUrl,\n locale,\n locales,\n defaultLocale,\n multiZoneDraftMode: this.nextConfig.experimental.multiZoneDraftMode,\n // For getServerSideProps and getInitialProps we need to ensure we use the original URL\n // and not the resolved URL to prevent a hydration mismatch on\n // asPath\n resolvedAsPath:\n hasServerProps || hasGetInitialProps\n ? formatUrl({\n // we use the original URL pathname less the _next/data prefix if\n // present\n pathname: `${urlPathname}${hadTrailingSlash ? '/' : ''}`,\n query: origQuery,\n })\n : resolvedUrl,\n experimental: {\n ...opts.experimental,\n isRoutePPREnabled,\n },\n supportsDynamicResponse,\n shouldWaitOnAllReady,\n isOnDemandRevalidate,\n isDraftMode: isPreviewMode,\n isPossibleServerAction,\n postponed,\n waitUntil: this.getWaitUntil(),\n onClose: res.onClose.bind(res),\n onAfterTaskError: undefined,\n // only available in dev\n setIsrStatus: (this as any).setIsrStatus,\n }\n\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n supportsDynamicResponse = false\n renderOpts.nextExport = true\n renderOpts.supportsDynamicResponse = false\n renderOpts.isStaticGeneration = true\n renderOpts.isRevalidate = true\n renderOpts.isDebugDynamicAccesses = isDebugDynamicAccesses\n }\n\n // Legacy render methods will return a render result that needs to be\n // served by the server.\n let result: RenderResult\n\n if (routeModule) {\n if (isAppRouteRouteModule(routeModule)) {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME === 'edge' ||\n !isNodeNextRequest(req) ||\n !isNodeNextResponse(res)\n ) {\n throw new Error(\n 'Invariant: App Route Route Modules cannot be used in the edge runtime'\n )\n }\n\n const context: AppRouteRouteHandlerContext = {\n params: opts.params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n dynamicIO: renderOpts.experimental.dynamicIO,\n authInterrupts: renderOpts.experimental.authInterrupts,\n },\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: this.nextConfig.experimental?.cacheLife,\n isRevalidate: isSSG,\n waitUntil: this.getWaitUntil(),\n onClose: res.onClose.bind(res),\n onAfterTaskError: undefined,\n onInstrumentationRequestError:\n this.renderOpts.onInstrumentationRequestError,\n },\n sharedContext: {\n buildId: this.buildId,\n },\n }\n\n try {\n const request = NextRequestAdapter.fromNodeNextRequest(\n req,\n signalFromNodeResponse(res.originalResponse)\n )\n\n const response = await routeModule.handle(request, context)\n\n ;(req as any).fetchMetrics = (\n context.renderOpts as any\n ).fetchMetrics\n\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isSSG) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n isFallback: false,\n }\n\n return cacheEntry\n }\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (context.renderOpts.waitUntil) {\n context.renderOpts.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n\n // Send the response now that we have copied it into the cache.\n await sendResponse(\n req,\n res,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n } catch (err) {\n await this.instrumentationOnRequestError(err, req, {\n routerKind: 'App Router',\n routePath: pathname,\n routeType: 'route',\n revalidateReason: getRevalidateReason(renderOpts),\n })\n\n // If this is during static generation, throw the error again.\n if (isSSG) throw err\n\n Log.error(err)\n\n // Otherwise, send a 500 response.\n await sendResponse(req, res, new Response(null, { status: 500 }))\n\n return null\n }\n } else if (\n isPagesRouteModule(routeModule) ||\n isAppPageRouteModule(routeModule)\n ) {\n // An OPTIONS request to a page handler is invalid.\n if (req.method === 'OPTIONS' && !is404Page) {\n await sendResponse(req, res, new Response(null, { status: 400 }))\n return null\n }\n\n if (isPagesRouteModule(routeModule)) {\n // Due to the way we pass data by mutating `renderOpts`, we can't extend\n // the object here but only updating its `clientReferenceManifest` and\n // `nextFontManifest` properties.\n // https://github.com/vercel/next.js/blob/df7cbd904c3bd85f399d1ce90680c0ecf92d2752/packages/next/server/render.tsx#L947-L952\n renderOpts.nextFontManifest = this.nextFontManifest\n renderOpts.clientReferenceManifest =\n components.clientReferenceManifest\n\n const request = isNodeNextRequest(req) ? req.originalRequest : req\n const response = isNodeNextResponse(res)\n ? res.originalResponse\n : res\n\n // Call the built-in render method on the module.\n try {\n result = await routeModule.render(\n request as any,\n response as any,\n {\n page: pathname,\n params: opts.params,\n query,\n renderOpts,\n sharedContext: {\n buildId: this.buildId,\n deploymentId: this.nextConfig.deploymentId,\n customServer: this.serverOptions.customServer || undefined,\n },\n renderContext: {\n isFallback: pagesFallback,\n isDraftMode: renderOpts.isDraftMode,\n developmentNotFoundSourcePage: getRequestMeta(\n req,\n 'developmentNotFoundSourcePage'\n ),\n },\n }\n )\n } catch (err) {\n await this.instrumentationOnRequestError(err, req, {\n routerKind: 'Pages Router',\n routePath: pathname,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isRevalidate: isSSG,\n isOnDemandRevalidate: renderOpts.isOnDemandRevalidate,\n }),\n })\n throw err\n }\n } else {\n const module = components.routeModule as AppPageRouteModule\n\n // Due to the way we pass data by mutating `renderOpts`, we can't extend the\n // object here but only updating its `nextFontManifest` field.\n // https://github.com/vercel/next.js/blob/df7cbd904c3bd85f399d1ce90680c0ecf92d2752/packages/next/server/render.tsx#L947-L952\n renderOpts.nextFontManifest = this.nextFontManifest\n\n const context: AppPageRouteHandlerContext = {\n page: is404Page ? '/404' : pathname,\n params: opts.params,\n query,\n fallbackRouteParams,\n renderOpts,\n serverComponentsHmrCache: this.getServerComponentsHmrCache(),\n sharedContext: {\n buildId: this.buildId,\n },\n }\n\n // TODO: adapt for putting the RDC inside the postponed data\n // If we're in dev, and this isn't a prefetch or a server action,\n // we should seed the resume data cache.\n if (\n this.nextConfig.experimental.dynamicIO &&\n this.renderOpts.dev &&\n !isPrefetchRSCRequest &&\n !isPossibleServerAction\n ) {\n const warmup = await module.warmup(req, res, context)\n\n // If the warmup is successful, we should use the resume data\n // cache from the warmup.\n if (warmup.metadata.devRenderResumeDataCache) {\n renderOpts.devRenderResumeDataCache =\n warmup.metadata.devRenderResumeDataCache\n }\n }\n\n // Call the built-in render method on the module.\n result = await module.render(req, res, context)\n }\n } else {\n throw new Error('Invariant: Unknown route module type')\n }\n } else {\n // If we didn't match a page, we should fallback to using the legacy\n // render method.\n result = await this.renderHTML(req, res, pathname, query, renderOpts)\n }\n\n const { metadata } = result\n\n const {\n cacheControl,\n headers = {},\n // Add any fetch tags that were on the page to the response headers.\n fetchTags: cacheTags,\n } = metadata\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // we don't throw static to dynamic errors in dev as isSSG\n // is a best guess in dev since we don't have the prerender pass\n // to know whether the path is actually static or not\n if (\n isAppPath &&\n isSSG &&\n cacheControl?.revalidate === 0 &&\n !this.renderOpts.dev &&\n !isRoutePPREnabled\n ) {\n const staticBailoutInfo = metadata.staticBailoutInfo\n\n const err = new Error(\n `Page changed from static to dynamic at runtime ${urlPathname}${\n staticBailoutInfo?.description\n ? `, reason: ${staticBailoutInfo.description}`\n : ``\n }` +\n `\\nsee more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`\n )\n\n if (staticBailoutInfo?.stack) {\n const stack = staticBailoutInfo.stack\n err.stack = err.message + stack.substring(stack.indexOf('\\n'))\n }\n\n throw err\n }\n\n // Based on the metadata, we can determine what kind of cache result we\n // should return.\n\n // Handle `isNotFound`.\n if ('isNotFound' in metadata && metadata.isNotFound) {\n return {\n value: null,\n cacheControl,\n isFallback: false,\n } satisfies ResponseCacheEntry\n }\n\n // Handle `isRedirect`.\n if (metadata.isRedirect) {\n return {\n value: {\n kind: CachedRouteKind.REDIRECT,\n props: metadata.pageData ?? metadata.flightData,\n } satisfies CachedRedirectValue,\n cacheControl,\n isFallback: false,\n } satisfies ResponseCacheEntry\n }\n\n // Handle `isNull`.\n if (result.isNull) {\n return null\n }\n\n // We now have a valid HTML result that we can return to the user.\n if (isAppPath) {\n return {\n value: {\n kind: CachedRouteKind.APP_PAGE,\n html: result,\n headers,\n rscData: metadata.flightData,\n postponed: metadata.postponed,\n status: res.statusCode,\n segmentData: metadata.segmentData,\n } satisfies CachedAppPageValue,\n cacheControl,\n isFallback: !!fallbackRouteParams,\n } satisfies ResponseCacheEntry\n }\n\n return {\n value: {\n kind: CachedRouteKind.PAGES,\n html: result,\n pageData: metadata.pageData ?? metadata.flightData,\n headers,\n status: isAppPath ? res.statusCode : undefined,\n } satisfies CachedPageValue,\n cacheControl,\n isFallback: pagesFallback,\n }\n }\n\n let responseGenerator: ResponseGenerator = async ({\n hasResolved,\n previousCacheEntry,\n isRevalidating,\n }): Promise<ResponseCacheEntry | null> => {\n const isProduction = !this.renderOpts.dev\n const didRespond = hasResolved || res.sent\n\n // If we haven't found the static paths for the route, then do it now.\n if (!staticPaths && isDynamic) {\n if (hasGetStaticPaths) {\n const pathsResult = await this.getStaticPaths({\n pathname,\n requestHeaders: req.headers,\n isAppPath,\n page: components.page,\n })\n\n staticPaths = pathsResult.staticPaths\n fallbackMode = pathsResult.fallbackMode\n } else {\n staticPaths = undefined\n fallbackMode = FallbackMode.NOT_FOUND\n }\n }\n\n // When serving a bot request, we want to serve a blocking render and not\n // the prerendered page. This ensures that the correct content is served\n // to the bot in the head.\n if (\n fallbackMode === FallbackMode.PRERENDER &&\n isBot(req.headers['user-agent'] || '')\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // skip on-demand revalidate if cache is not present and\n // revalidate-if-generated is set\n if (\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry &&\n !this.minimalMode\n ) {\n await this.render404(req, res)\n return null\n }\n\n if (previousCacheEntry?.isStale === -1) {\n isOnDemandRevalidate = true\n }\n\n // TODO: adapt for PPR\n // only allow on-demand revalidate for fallback: true/blocking\n // or for prerendered fallback: false paths\n if (\n isOnDemandRevalidate &&\n (fallbackMode !== FallbackMode.NOT_FOUND || previousCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // We use `ssgCacheKey` here as it is normalized to match the encoding\n // from getStaticPaths along with including the locale.\n //\n // We use the `resolvedUrlPathname` for the development case when this\n // is an app path since it doesn't include locale information.\n //\n // We decode the `resolvedUrlPathname` to correctly match the app path\n // with prerendered paths.\n let staticPathKey = ssgCacheKey\n if (!staticPathKey && opts.dev && isAppPath) {\n staticPathKey = decodePathParams(resolvedUrlPathname)\n }\n if (staticPathKey && query.amp) {\n staticPathKey = staticPathKey.replace(/\\.amp$/, '')\n }\n\n const isPageIncludedInStaticPaths =\n staticPathKey && staticPaths?.includes(staticPathKey)\n\n // When experimental compile is used, no pages have been prerendered,\n // so they should all be blocking.\n\n // @ts-expect-error internal field\n if (this.nextConfig.experimental.isExperimentalCompile) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // When we did not respond from cache, we need to choose to block on\n // rendering or return a skeleton.\n //\n // - Data requests always block.\n // - Blocking mode fallback always blocks.\n // - Preview mode toggles all pages to be resolved in a blocking manner.\n // - Non-dynamic pages should block (though this is an impossible\n // case in production).\n // - Dynamic pages should return their skeleton if not defined in\n // getStaticPaths, then finish the data request on the client-side.\n //\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n !this.minimalMode &&\n fallbackMode !== FallbackMode.BLOCKING_STATIC_RENDER &&\n staticPathKey &&\n !didRespond &&\n !isPreviewMode &&\n isDynamic &&\n (isProduction || !staticPaths || !isPageIncludedInStaticPaths)\n ) {\n if (\n // In development, fall through to render to handle missing\n // getStaticPaths.\n (isProduction || (staticPaths && staticPaths?.length > 0)) &&\n // When fallback isn't present, abort this render so we 404\n fallbackMode === FallbackMode.NOT_FOUND\n ) {\n throw new NoFallbackError()\n }\n\n let fallbackResponse: ResponseCacheEntry | null | undefined\n\n // If this is a pages router page.\n if (isPagesRouteModule(components.routeModule) && !isNextDataRequest) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await this.responseCache.get(\n isProduction ? (locale ? `/${locale}${pathname}` : pathname) : null,\n // This is the response generator for the fallback shell.\n async ({\n previousCacheEntry: previousFallbackCacheEntry = null,\n }) => {\n // For the pages router, fallbacks cannot be revalidated or\n // generated in production. In the case of a missing fallback,\n // we return null, but if it's being revalidated, we just return\n // the previous fallback cache entry. This preserves the previous\n // behavior.\n if (isProduction) {\n return toResponseCacheEntry(previousFallbackCacheEntry)\n }\n\n // We pass `undefined` and `null` as it doesn't apply to the pages\n // router.\n return doRender({\n postponed: undefined,\n // For the pages router, fallbacks can only be generated on\n // demand in development, so if we're not in production, and we\n // aren't a app path.\n pagesFallback: true,\n fallbackRouteParams: null,\n })\n },\n {\n routeKind: RouteKind.PAGES,\n incrementalCache,\n isRoutePPREnabled,\n isFallback: true,\n }\n )\n }\n // If this is a app router page, PPR is enabled, and PFPR is also\n // enabled, then we should use the fallback renderer.\n else if (\n isRoutePPREnabled &&\n isAppPageRouteModule(components.routeModule) &&\n !isRSCRequest\n ) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await this.responseCache.get(\n isProduction ? pathname : null,\n // This is the response generator for the fallback shell.\n async () =>\n doRender({\n // We pass `undefined` as rendering a fallback isn't resumed\n // here.\n postponed: undefined,\n pagesFallback: undefined,\n fallbackRouteParams:\n // If we're in production of we're debugging the fallback\n // shell then we should postpone when dynamic params are\n // accessed.\n isProduction || isDebugFallbackShell\n ? getFallbackRouteParams(pathname)\n : null,\n }),\n {\n routeKind: RouteKind.APP_PAGE,\n incrementalCache,\n isRoutePPREnabled,\n isFallback: true,\n }\n )\n }\n\n // If the fallback response was set to null, then we should return null.\n if (fallbackResponse === null) return null\n\n // Otherwise, if we did get a fallback response, we should return it.\n if (fallbackResponse) {\n // Remove the cache control from the response to prevent it from being\n // used in the surrounding cache.\n delete fallbackResponse.cacheControl\n\n return fallbackResponse\n }\n }\n\n // Only requests that aren't revalidating can be resumed. If we have the\n // minimal postponed data, then we should resume the render with it.\n const postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // When we're in minimal mode, if we're trying to debug the static shell,\n // we should just return nothing instead of resuming the dynamic render.\n if (\n (isDebugStaticShell || isDebugDynamicAccesses) &&\n typeof postponed !== 'undefined'\n ) {\n return {\n cacheControl: { revalidate: 1, expire: undefined },\n isFallback: false,\n value: {\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(''),\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n // If this is a dynamic route with PPR enabled and the default route\n // matches were set, then we should pass the fallback route params to\n // the renderer as this is a fallback revalidation request.\n const fallbackRouteParams =\n isDynamic &&\n isRoutePPREnabled &&\n (getRequestMeta(req, 'didSetDefaultRouteMatches') ||\n isDebugFallbackShell)\n ? getFallbackRouteParams(pathname)\n : null\n\n // Perform the render.\n return doRender({\n postponed,\n pagesFallback: undefined,\n fallbackRouteParams,\n })\n }\n\n const cacheEntry = await this.responseCache.get(\n ssgCacheKey,\n responseGenerator,\n {\n routeKind:\n // If the route module is not defined, we can assume it's a page being\n // rendered and thus check isAppPath.\n routeModule?.definition.kind ??\n (isAppPath ? RouteKind.APP_PAGE : RouteKind.PAGES),\n incrementalCache,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n isRoutePPREnabled,\n }\n )\n\n if (isPreviewMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n if (!cacheEntry) {\n if (ssgCacheKey && !(isOnDemandRevalidate && revalidateOnlyGenerated)) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n return null\n }\n\n // If we're not in minimal mode and the cache entry that was returned was a\n // app page fallback, then we need to kick off the dynamic shell generation.\n if (\n ssgCacheKey &&\n !this.minimalMode &&\n isRoutePPREnabled &&\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE &&\n cacheEntry.isFallback &&\n !isOnDemandRevalidate &&\n // When we're debugging the fallback shell, we don't want to regenerate\n // the route shell.\n !isDebugFallbackShell &&\n process.env.DISABLE_ROUTE_SHELL_GENERATION !== 'true'\n ) {\n scheduleOnNextTick(async () => {\n try {\n await this.responseCache.get(\n ssgCacheKey,\n () =>\n doRender({\n // We're an on-demand request, so we don't need to pass in the\n // fallbackRouteParams.\n fallbackRouteParams: null,\n pagesFallback: undefined,\n postponed: undefined,\n }),\n {\n routeKind: RouteKind.APP_PAGE,\n incrementalCache,\n isOnDemandRevalidate: true,\n isPrefetch: false,\n isRoutePPREnabled: true,\n }\n )\n } catch (err) {\n console.error('Error occurred while rendering dynamic shell', err)\n }\n })\n }\n\n const didPostpone =\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE &&\n typeof cacheEntry.value.postponed === 'string'\n\n if (\n isSSG &&\n // We don't want to send a cache header for requests that contain dynamic\n // data. If this is a Dynamic RSC request or wasn't a Prefetch RSC\n // request, then we should set the cache header.\n !isDynamicRSCRequest &&\n (!didPostpone || isPrefetchRSCRequest)\n ) {\n if (!this.minimalMode) {\n // set x-nextjs-cache header to match the header\n // we set for the image-optimizer\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n // Set a header used by the client router to signal the response is static\n // and should respect the `static` cache staleTime value.\n res.setHeader(NEXT_IS_PRERENDER_HEADER, '1')\n }\n\n const { value: cachedData } = cacheEntry\n\n // If the cache value is an image, we should error early.\n if (cachedData?.kind === CachedRouteKind.IMAGE) {\n throw new InvariantError('SSG should not return an image cache value')\n }\n\n // Coerce the cache control parameter from the render.\n let cacheControl: CacheControl | undefined\n\n // If this is a resume request in minimal mode it is streamed with dynamic\n // content and should not be cached.\n if (minimalPostponed) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this is in minimal mode and this is a flight request that isn't a\n // prefetch request while PPR is enabled, it cannot be cached as it contains\n // dynamic content.\n else if (\n this.minimalMode &&\n isRSCRequest &&\n !isPrefetchRSCRequest &&\n isRoutePPREnabled\n ) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (!this.renderOpts.dev || (hasServerProps && !isNextDataRequest)) {\n // If this is a preview mode request, we shouldn't cache it\n if (isPreviewMode) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this isn't SSG, then we should set change the header only if it is\n // not set already.\n else if (!isSSG) {\n if (!res.getHeader('Cache-Control')) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n }\n\n // If we are rendering the 404 page we derive the cache-control\n // revalidate period from the value that trigged the not found\n // to be rendered. So if `getStaticProps` returns\n // { notFound: true, revalidate 60 } the revalidate period should\n // be 60 but if a static asset 404s directly it should have a revalidate\n // period of 0 so that it doesn't get cached unexpectedly by a CDN\n else if (is404Page) {\n const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate')\n\n cacheControl = {\n revalidate:\n typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate,\n expire: undefined,\n }\n } else if (is500Page) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (cacheEntry.cacheControl) {\n // If the cache entry has a cache control with a revalidate value that's\n // a number, use it.\n if (typeof cacheEntry.cacheControl.revalidate === 'number') {\n if (cacheEntry.cacheControl.revalidate < 1) {\n throw new Error(\n `Invalid revalidate configuration provided: ${cacheEntry.cacheControl.revalidate} < 1`\n )\n }\n\n cacheControl = {\n revalidate: cacheEntry.cacheControl.revalidate,\n expire:\n cacheEntry.cacheControl?.expire ?? this.nextConfig.expireTime,\n }\n }\n // Otherwise if the revalidate value is false, then we should use the\n // cache time of one year.\n else {\n cacheControl = { revalidate: CACHE_ONE_YEAR, expire: undefined }\n }\n }\n }\n\n cacheEntry.cacheControl = cacheControl\n\n if (\n typeof segmentPrefetchHeader === 'string' &&\n cachedData?.kind === CachedRouteKind.APP_PAGE &&\n cachedData.segmentData\n ) {\n // This is a prefetch request issued by the client Segment Cache. These\n // should never reach the application layer (lambda). We should either\n // respond from the cache (HIT) or respond with 204 No Content (MISS).\n\n // Set a header to indicate that PPR is enabled for this route. This\n // lets the client distinguish between a regular cache miss and a cache\n // miss due to PPR being disabled. In other contexts this header is used\n // to indicate that the response contains dynamic data, but here we're\n // only using it to indicate that the feature is enabled — the segment\n // response itself contains whether the data is dynamic.\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '2')\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (this.minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n const matchedSegment = cachedData.segmentData.get(segmentPrefetchHeader)\n if (matchedSegment !== undefined) {\n // Cache hit\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(matchedSegment),\n // TODO: Eventually this should use cache control of the individual\n // segment, not the whole page.\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // Cache miss. Either a cache entry for this route has not been generated\n // (which technically should not be possible when PPR is enabled, because\n // at a minimum there should always be a fallback entry) or there's no\n // match for the requested segment. Respond with a 204 No Content. We\n // don't bother to respond with 404, because these requests are only\n // issued as part of a prefetch.\n res.statusCode = 204\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(''),\n cacheControl: cacheEntry?.cacheControl,\n }\n }\n\n // If there's a callback for `onCacheEntry`, call it with the cache entry\n // and the revalidate options.\n const onCacheEntry = getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(\n {\n ...cacheEntry,\n // TODO: remove this when upstream doesn't\n // always expect this value to be \"PAGE\"\n value: {\n ...cacheEntry.value,\n kind:\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE\n ? 'PAGE'\n : cacheEntry.value?.kind,\n },\n },\n {\n url: getRequestMeta(req, 'initURL'),\n }\n )\n if (finished) {\n // TODO: maybe we have to end the request?\n return null\n }\n }\n\n if (!cachedData) {\n // add revalidate metadata before rendering 404 page\n // so that we can use this as source of truth for the\n // cache-control header instead of what the 404 page returns\n // for the revalidate value\n addRequestMeta(\n req,\n 'notFoundRevalidate',\n cacheEntry.cacheControl?.revalidate\n )\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n if (isNextDataRequest) {\n res.statusCode = 404\n res.body('{\"notFound\":true}').send()\n return null\n }\n\n if (this.renderOpts.dev) {\n addRequestMeta(req, 'developmentNotFoundSourcePage', pathname)\n }\n await this.render404(req, res, { pathname, query }, false)\n return null\n } else if (cachedData.kind === CachedRouteKind.REDIRECT) {\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n if (isNextDataRequest) {\n return {\n type: 'json',\n body: RenderResult.fromStatic(\n // @TODO: Handle flight data.\n JSON.stringify(cachedData.props)\n ),\n cacheControl: cacheEntry.cacheControl,\n }\n } else {\n await handleRedirect(cachedData.props)\n return null\n }\n } else if (cachedData.kind === CachedRouteKind.APP_ROUTE) {\n const headers = fromNodeOutgoingHttpHeaders(cachedData.headers)\n\n if (!(this.minimalMode && isSSG)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n req,\n res,\n new Response(cachedData.body, {\n headers,\n status: cachedData.status || 200,\n })\n )\n return null\n } else if (cachedData.kind === CachedRouteKind.APP_PAGE) {\n // If the request has a postponed state and it's a resume request we\n // should error.\n if (didPostpone && minimalPostponed) {\n throw new Error(\n 'Invariant: postponed state should not be present on a resume request'\n )\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!this.minimalMode || !isSSG) {\n delete headers[NEXT_CACHE_TAGS_HEADER]\n }\n\n for (let [key, value] of Object.entries(headers)) {\n if (typeof value === 'undefined') continue\n\n if (Array.isArray(value)) {\n for (const v of value) {\n res.appendHeader(key, v)\n }\n } else if (typeof value === 'number') {\n value = value.toString()\n res.appendHeader(key, value)\n } else {\n res.appendHeader(key, value)\n }\n }\n }\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (this.minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n // If the request is a data request, then we shouldn't set the status code\n // from the response because it should always be 200. This should be gated\n // behind the experimental PPR flag.\n if (cachedData.status && (!isRSCRequest || !isRoutePPREnabled)) {\n res.statusCode = cachedData.status\n }\n\n // Mark that the request did postpone.\n if (didPostpone) {\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '1')\n }\n\n // we don't go through this block when preview mode is true\n // as preview mode is a dynamic request (bypasses cache) and doesn't\n // generate both HTML and payloads in the same request so continue to just\n // return the generated payload\n if (isRSCRequest && !isPreviewMode) {\n // If this is a dynamic RSC request, then stream the response.\n if (typeof cachedData.rscData === 'undefined') {\n if (cachedData.postponed) {\n throw new Error('Invariant: Expected postponed to be undefined')\n }\n\n return {\n type: 'rsc',\n body: cachedData.html,\n // Dynamic RSC responses cannot be cached, even if they're\n // configured with `force-static` because we have no way of\n // distinguishing between `force-static` and pages that have no\n // postponed state.\n // TODO: distinguish `force-static` from pages with no postponed state (static)\n cacheControl: isDynamicRSCRequest\n ? { revalidate: 0, expire: undefined }\n : cacheEntry.cacheControl,\n }\n }\n\n // As this isn't a prefetch request, we should serve the static flight\n // data.\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(cachedData.rscData),\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // This is a request for HTML data.\n let body = cachedData.html\n\n // If there's no postponed state, we should just serve the HTML. This\n // should also be the case for a resume request because it's completed\n // as a server render (rather than a static render).\n if (!didPostpone || this.minimalMode) {\n return {\n type: 'html',\n body,\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // If we're debugging the static shell or the dynamic API accesses, we\n // should just serve the HTML without resuming the render. The returned\n // HTML will be the static shell so all the Dynamic API's will be used\n // during static generation.\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n // Since we're not resuming the render, we need to at least add the\n // closing body and html tags to create valid HTML.\n body.chain(\n new ReadableStream({\n start(controller) {\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n controller.close()\n },\n })\n )\n\n return {\n type: 'html',\n body,\n cacheControl: { revalidate: 0, expire: undefined },\n }\n }\n\n // This request has postponed, so let's create a new transformer that the\n // dynamic data can pipe to that will attach the dynamic data to the end\n // of the response.\n const transformer = new TransformStream<Uint8Array, Uint8Array>()\n body.chain(transformer.readable)\n\n // Perform the render again, but this time, provide the postponed state.\n // We don't await because we want the result to start streaming now, and\n // we've already chained the transformer's readable to the render result.\n doRender({\n postponed: cachedData.postponed,\n pagesFallback: undefined,\n // This is a resume render, not a fallback render, so we don't need to\n // set this.\n fallbackRouteParams: null,\n })\n .then(async (result) => {\n if (!result) {\n throw new Error('Invariant: expected a result to be returned')\n }\n\n if (result.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant: expected a page response, got ${result.value?.kind}`\n )\n }\n\n // Pipe the resume result to the transformer.\n await result.value.html.pipeTo(transformer.writable)\n })\n .catch((err) => {\n // An error occurred during piping or preparing the render, abort\n // the transformers writer so we can terminate the stream.\n transformer.writable.abort(err).catch((e) => {\n console.error(\"couldn't abort transformer\", e)\n })\n })\n\n return {\n type: 'html',\n body,\n // We don't want to cache the response if it has postponed data because\n // the response being sent to the client it's dynamic parts are streamed\n // to the client on the same request.\n cacheControl: { revalidate: 0, expire: undefined },\n }\n } else if (isNextDataRequest) {\n return {\n type: 'json',\n body: RenderResult.fromStatic(JSON.stringify(cachedData.pageData)),\n cacheControl: cacheEntry.cacheControl,\n }\n } else {\n return {\n type: 'html',\n body: cachedData.html,\n cacheControl: cacheEntry.cacheControl,\n }\n }\n }\n\n private stripNextDataPath(path: string, stripLocale = true) {\n if (path.includes(this.buildId)) {\n const splitPath = path.substring(\n path.indexOf(this.buildId) + this.buildId.length\n )\n\n path = denormalizePagePath(splitPath.replace(/\\.json$/, ''))\n }\n\n if (this.localeNormalizer && stripLocale) {\n return this.localeNormalizer.normalize(path)\n }\n return path\n }\n\n // map the route to the actual bundle name\n protected getOriginalAppPaths(route: string) {\n if (this.enabledDirectories.app) {\n const originalAppPath = this.appPathRoutes?.[route]\n\n if (!originalAppPath) {\n return null\n }\n\n return originalAppPath\n }\n return null\n }\n\n protected async renderPageComponent(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n bubbleNoFallback: boolean\n ) {\n const { query, pathname } = ctx\n\n const appPaths = this.getOriginalAppPaths(pathname)\n const isAppPath = Array.isArray(appPaths)\n\n let page = pathname\n if (isAppPath) {\n // the last item in the array is the root page, if there are parallel routes\n page = appPaths[appPaths.length - 1]\n }\n\n const result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page,\n query,\n params: ctx.renderOpts.params || {},\n isAppPath,\n sriEnabled: !!this.nextConfig.experimental.sri?.algorithm,\n appPaths,\n // Ensuring for loading page component routes is done via the matcher.\n shouldEnsure: false,\n })\n if (result) {\n getTracer().setRootSpanAttribute('next.route', pathname)\n try {\n return await this.renderToResponseWithComponents(ctx, result)\n } catch (err) {\n const isNoFallbackError = err instanceof NoFallbackError\n\n if (!isNoFallbackError || (isNoFallbackError && bubbleNoFallback)) {\n throw err\n }\n }\n }\n return false\n }\n\n private async renderToResponse(\n ctx: RequestContext<ServerRequest, ServerResponse>\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(\n BaseServerSpan.renderToResponse,\n {\n spanName: `rendering page`,\n attributes: {\n 'next.route': ctx.pathname,\n },\n },\n async () => {\n return this.renderToResponseImpl(ctx)\n }\n )\n }\n\n protected abstract getMiddleware(): Promise<MiddlewareRoutingItem | undefined>\n protected abstract getFallbackErrorComponents(\n url?: string\n ): Promise<LoadComponentsReturnType | null>\n protected abstract getRoutesManifest(): NormalizedRouteManifest | undefined\n\n private async renderToResponseImpl(\n ctx: RequestContext<ServerRequest, ServerResponse>\n ): Promise<ResponsePayload | null> {\n const { req, res, query, pathname } = ctx\n let page = pathname\n const bubbleNoFallback =\n getRequestMeta(ctx.req, 'bubbleNoFallback') ?? false\n delete query[NEXT_RSC_UNION_QUERY]\n\n const options: MatchOptions = {\n i18n: this.i18nProvider?.fromRequest(req, pathname),\n }\n\n try {\n for await (const match of this.matchers.matchAll(pathname, options)) {\n // when a specific invoke-output is meant to be matched\n // ensure a prior dynamic route/page doesn't take priority\n const invokeOutput = getRequestMeta(ctx.req, 'invokeOutput')\n if (\n !this.minimalMode &&\n typeof invokeOutput === 'string' &&\n isDynamicRoute(invokeOutput || '') &&\n invokeOutput !== match.definition.pathname\n ) {\n continue\n }\n\n const result = await this.renderPageComponent(\n {\n ...ctx,\n pathname: match.definition.pathname,\n renderOpts: {\n ...ctx.renderOpts,\n params: match.params,\n },\n },\n bubbleNoFallback\n )\n if (result !== false) return result\n }\n\n // currently edge functions aren't receiving the x-matched-path\n // header so we need to fallback to matching the current page\n // when we weren't able to match via dynamic route to handle\n // the rewrite case\n // @ts-expect-error extended in child class web-server\n if (this.serverOptions.webServerConfig) {\n // @ts-expect-error extended in child class web-server\n ctx.pathname = this.serverOptions.webServerConfig.page\n const result = await this.renderPageComponent(ctx, bubbleNoFallback)\n if (result !== false) return result\n }\n } catch (error) {\n const err = getProperError(error)\n\n if (error instanceof MissingStaticPage) {\n console.error(\n 'Invariant: failed to load static page',\n JSON.stringify(\n {\n page,\n url: ctx.req.url,\n matchedPath: ctx.req.headers[MATCHED_PATH_HEADER],\n initUrl: getRequestMeta(ctx.req, 'initURL'),\n didRewrite: !!getRequestMeta(ctx.req, 'rewroteURL'),\n rewroteUrl: getRequestMeta(ctx.req, 'rewroteURL'),\n },\n null,\n 2\n )\n )\n throw err\n }\n\n if (err instanceof NoFallbackError && bubbleNoFallback) {\n throw err\n }\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return await this.renderErrorToResponse(ctx, err)\n }\n\n res.statusCode = 500\n\n // if pages/500 is present we still need to trigger\n // /_error `getInitialProps` to allow reporting error\n if (await this.hasPage('/500')) {\n addRequestMeta(ctx.req, 'customErrorRender', true)\n await this.renderErrorToResponse(ctx, err)\n removeRequestMeta(ctx.req, 'customErrorRender')\n }\n\n const isWrappedError = err instanceof WrappedBuildError\n\n if (!isWrappedError) {\n if (\n (this.minimalMode && process.env.NEXT_RUNTIME !== 'edge') ||\n this.renderOpts.dev\n ) {\n if (isError(err)) err.page = page\n throw err\n }\n this.logError(getProperError(err))\n }\n const response = await this.renderErrorToResponse(\n ctx,\n isWrappedError ? (err as WrappedBuildError).innerError : err\n )\n return response\n }\n\n const middleware = await this.getMiddleware()\n if (\n middleware &&\n !!ctx.req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200 || res.statusCode === 404)\n ) {\n const locale = getRequestMeta(req, 'locale')\n\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n res.statusCode = 200\n res.setHeader('content-type', 'application/json')\n res.body('{}')\n res.send()\n return null\n }\n\n res.statusCode = 404\n return this.renderErrorToResponse(ctx, null)\n }\n\n public async renderToHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return getTracer().trace(BaseServerSpan.renderToHTML, async () => {\n return this.renderToHTMLImpl(req, res, pathname, query)\n })\n }\n\n private async renderToHTMLImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return this.getStaticHTML((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async renderError(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.renderError, async () => {\n return this.renderErrorImpl(err, req, res, pathname, query, setHeaders)\n })\n }\n\n private async renderErrorImpl(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise<void> {\n if (setHeaders) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n return this.pipe(\n async (ctx) => {\n const response = await this.renderErrorToResponse(ctx, err)\n if (this.minimalMode && res.statusCode === 500) {\n throw err\n }\n return response\n },\n { req, res, pathname, query }\n )\n }\n\n private customErrorNo404Warn = execOnce(() => {\n Log.warn(\n `You have added a custom /_error page without a custom /404 page. This prevents the 404 page from being auto statically optimized.\\nSee here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`\n )\n })\n\n private async renderErrorToResponse(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n err: Error | null\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(BaseServerSpan.renderErrorToResponse, async () => {\n return this.renderErrorToResponseImpl(ctx, err)\n })\n }\n\n protected async renderErrorToResponseImpl(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n err: Error | null\n ): Promise<ResponsePayload | null> {\n // Short-circuit favicon.ico in development to avoid compiling 404 page when the app has no favicon.ico.\n // Since favicon.ico is automatically requested by the browser.\n if (this.renderOpts.dev && ctx.pathname === '/favicon.ico') {\n return {\n type: 'html',\n body: RenderResult.fromStatic(''),\n }\n }\n const { res, query } = ctx\n\n try {\n let result: null | FindComponentsResult = null\n\n const is404 = res.statusCode === 404\n let using404Page = false\n\n if (is404) {\n if (this.enabledDirectories.app) {\n // Use the not-found entry in app directory\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n query,\n params: {},\n isAppPath: true,\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n\n if (!result && (await this.hasPage('/404'))) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/404',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 404 route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n }\n let statusPage = `/${res.statusCode}`\n\n if (\n !getRequestMeta(ctx.req, 'customErrorRender') &&\n !result &&\n STATIC_STATUS_PAGES.includes(statusPage)\n ) {\n // skip ensuring /500 in dev mode as it isn't used and the\n // dev overlay is used instead\n if (statusPage !== '/500' || !this.renderOpts.dev) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: statusPage,\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 500\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n }\n }\n\n if (!result) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/_error',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" an error\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n statusPage = '/_error'\n }\n\n if (\n process.env.NODE_ENV !== 'production' &&\n !using404Page &&\n (await this.hasPage('/_error')) &&\n !(await this.hasPage('/404'))\n ) {\n this.customErrorNo404Warn()\n }\n\n if (!result) {\n // this can occur when a project directory has been moved/deleted\n // which is handled in the parent process in development\n if (this.renderOpts.dev) {\n return {\n type: 'html',\n // wait for dev-server to restart before refreshing\n body: RenderResult.fromStatic(\n `\n <pre>missing required error components, refreshing...</pre>\n <script>\n async function check() {\n const res = await fetch(location.href).catch(() => ({}))\n\n if (res.status === 200) {\n location.reload()\n } else {\n setTimeout(check, 1000)\n }\n }\n check()\n </script>`\n ),\n }\n }\n\n throw new WrappedBuildError(\n new Error('missing required error components')\n )\n }\n\n // If the page has a route module, use it for the new match. If it doesn't\n // have a route module, remove the match.\n if (result.components.routeModule) {\n addRequestMeta(ctx.req, 'match', {\n definition: result.components.routeModule.definition,\n params: undefined,\n })\n } else {\n removeRequestMeta(ctx.req, 'match')\n }\n\n try {\n return await this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: statusPage,\n renderOpts: {\n ...ctx.renderOpts,\n err,\n },\n },\n result\n )\n } catch (maybeFallbackError) {\n if (maybeFallbackError instanceof NoFallbackError) {\n throw new Error('invariant: failed to render error page')\n }\n throw maybeFallbackError\n }\n } catch (error) {\n const renderToHtmlError = getProperError(error)\n const isWrappedError = renderToHtmlError instanceof WrappedBuildError\n if (!isWrappedError) {\n this.logError(renderToHtmlError)\n }\n res.statusCode = 500\n const fallbackComponents = await this.getFallbackErrorComponents(\n ctx.req.url\n )\n\n if (fallbackComponents) {\n // There was an error, so use it's definition from the route module\n // to add the match to the request.\n addRequestMeta(ctx.req, 'match', {\n definition: fallbackComponents.routeModule!.definition,\n params: undefined,\n })\n\n return this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: '/_error',\n renderOpts: {\n ...ctx.renderOpts,\n // We render `renderToHtmlError` here because `err` is\n // already captured in the stacktrace.\n err: isWrappedError\n ? renderToHtmlError.innerError\n : renderToHtmlError,\n },\n },\n {\n query,\n components: fallbackComponents,\n }\n )\n }\n return {\n type: 'html',\n body: RenderResult.fromStatic('Internal Server Error'),\n }\n }\n }\n\n public async renderErrorToHTML(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return this.getStaticHTML((ctx) => this.renderErrorToResponse(ctx, err), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async render404(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: Pick<NextUrlWithParsedQuery, 'pathname' | 'query'>,\n setHeaders = true\n ): Promise<void> {\n const { pathname, query } = parsedUrl ? parsedUrl : parseUrl(req.url!, true)\n\n // Ensure the locales are provided on the request meta.\n if (this.nextConfig.i18n) {\n if (!getRequestMeta(req, 'locale')) {\n addRequestMeta(req, 'locale', this.nextConfig.i18n.defaultLocale)\n }\n addRequestMeta(req, 'defaultLocale', this.nextConfig.i18n.defaultLocale)\n }\n\n res.statusCode = 404\n return this.renderError(null, req, res, pathname!, query, setHeaders)\n }\n}\n"],"names":["getFallbackRouteParams","CachedRouteKind","NormalizeError","DecodeError","normalizeRepeatedSlashes","MissingStaticPage","format","formatUrl","parse","parseUrl","formatHostname","getRedirectStatus","isEdgeRuntime","APP_PATHS_MANIFEST","NEXT_BUILTIN_DOCUMENT","PAGES_MANIFEST","STATIC_STATUS_PAGES","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","isDynamicRoute","checkIsOnDemandRevalidate","setConfig","getCacheControlHeader","execOnce","isBlockedPage","getBotType","isBot","RenderResult","removeTrailingSlash","denormalizePagePath","Log","getPreviouslyRevalidatedTags","getUtils","isError","getProperError","addRequestMeta","getRequestMeta","removeRequestMeta","setRequestMeta","removePathPrefix","normalizeAppPath","getHostname","parseUrlUtil","getNextPathnameInfo","RSC_HEADER","NEXT_RSC_UNION_QUERY","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_DID_POSTPONE_HEADER","NEXT_URL","NEXT_IS_PRERENDER_HEADER","LocaleRouteNormalizer","DefaultRouteMatcherManager","AppPageRouteMatcherProvider","AppRouteRouteMatcherProvider","PagesAPIRouteMatcherProvider","PagesRouteMatcherProvider","ServerManifestLoader","getTracer","isBubbledError","SpanKind","BaseServerSpan","I18NProvider","sendResponse","fromNodeOutgoingHttpHeaders","normalizeNextQueryParam","toNodeOutgoingHttpHeaders","CACHE_ONE_YEAR","INFINITE_CACHE","MATCHED_PATH_HEADER","NEXT_CACHE_TAGS_HEADER","NEXT_RESUME_HEADER","normalizeLocalePath","NextRequestAdapter","signalFromNodeResponse","matchNextDataPathname","getRouteFromAssetPath","decodePathParams","RSCPathnameNormalizer","stripFlightHeaders","isAppPageRouteModule","isAppRouteRouteModule","isPagesRouteModule","PrefetchRSCPathnameNormalizer","NextDataPathnameNormalizer","getIsPossibleServerAction","isInterceptionRouteAppPath","toRoute","isNodeNextRequest","isNodeNextResponse","patchSetHeaderWithCookieSupport","checkIsAppPPREnabled","getBuiltinRequestContext","ENCODED_TAGS","NextRequestHint","getRevalidateReason","RouteKind","FallbackMode","parseFallbackField","toResponseCacheEntry","scheduleOnNextTick","SegmentPrefixRSCPathnameNormalizer","shouldServeStreamingMetadata","isHtmlBotRequest","InvariantError","decodeQueryPathParameter","getCacheHandlers","NoFallbackError","Error","WrappedBuildError","constructor","innerError","Server","getServerComponentsHmrCache","nextConfig","experimental","serverComponentsHmrCache","globalThis","__serverComponentsHmrCache","undefined","options","handleRSCRequest","req","_res","parsedUrl","pathname","normalizers","segmentPrefetchRSC","match","result","extract","originalPathname","segmentPath","headers","toLowerCase","prefetchRSC","normalize","rsc","segmentPrefetchRSCRequest","url","parsed","handleNextDataRequest","res","middleware","getMiddleware","params","path","buildId","process","env","NEXT_RUNTIME","render404","shift","lastParam","length","endsWith","join","trailingSlash","substring","i18nProvider","hostname","host","split","domainLocale","detectDomainLocale","defaultLocale","config","localePathResult","analyze","detectedLocale","handleNextImageRequest","handleCatchallRenderRequest","handleCatchallMiddlewareRequest","data","push","normalizer","normalizeAndAttachMetadata","finished","enabledDirectories","pages","prepared","preparedPromise","customErrorNo404Warn","warn","dir","quiet","conf","dev","minimalMode","port","experimentalTestProxy","serverOptions","require","resolve","loadEnvConfig","fetchHostname","distDir","publicDir","getPublicDir","hasStaticDir","getHasStaticDir","i18n","locales","localeNormalizer","serverRuntimeConfig","publicRuntimeConfig","assetPrefix","generateEtags","getBuildId","minimalModeKey","NEXT_PRIVATE_MINIMAL_MODE","getEnabledDirectories","isAppPPREnabled","app","ppr","isAppSegmentPrefetchEnabled","clientSegmentCache","nextFontManifest","getNextFontManifest","NEXT_DEPLOYMENT_ID","deploymentId","renderOpts","supportsDynamicResponse","strictNextHead","poweredByHeader","canonicalBase","amp","previewProps","getPrerenderManifest","preview","ampOptimizerConfig","optimizer","basePath","images","optimizeCss","nextConfigOutput","output","nextScriptWorkers","disableOptimizedLoading","domainLocales","domains","serverComponents","cacheLifeProfiles","cacheLife","enableTainting","taint","crossOrigin","largePageDataBytes","runtimeConfig","Object","keys","isExperimentalCompile","htmlLimitedBots","expireTime","clientTraceMetadata","dynamicIO","Boolean","dynamicOnHover","inlineCss","authInterrupts","onInstrumentationRequestError","instrumentationOnRequestError","bind","reactMaxHeadersLength","pagesManifest","getPagesManifest","appPathsManifest","getAppPathsManifest","appPathRoutes","getAppPathRoutes","interceptionRoutePatterns","getinterceptionRoutePatterns","matchers","getRouteMatchers","reload","setAssetPrefix","responseCache","getResponseCache","reloadMatchers","manifestLoader","name","args","err","ctx","instrumentation","onRequestError","method","fromEntries","entries","handlerErr","console","error","logError","handleRequest","prepare","toUpperCase","tracer","withPropagatedContext","trace","spanName","kind","SERVER","attributes","span","handleRequestImpl","finally","isRSCRequest","setAttributes","statusCode","rootSpanAttributes","getRootSpanAttributes","get","route","updateName","originalRequest","waitTillReady","originalResponse","urlParts","urlNoQuery","cleanUrl","redirect","body","send","query","URLSearchParams","xForwardedProto","isHttps","socket","encrypted","toString","remoteAddress","attachRequestMeta","replace","pathnameInfo","useMatchedPathHeader","matchedPath","URL","urlPathname","chunk","postponed","Buffer","concat","normalizedUrlPath","stripNextDataPath","localeAnalysisResult","inferredFromDefault","srcPathname","pageIsDynamic","paramsResult","hasValidParams","definition","utils","page","rewrites","getRoutesManifest","beforeFiles","afterFiles","fallback","caseSensitive","caseSensitiveRoutes","locale","originQueryParams","pathnameBeforeRewrite","rewriteParamKeys","handleRewrites","queryParams","didRewrite","routeParamKeys","Set","key","value","normalizedKey","add","Array","isArray","map","v","normalizeDynamicRouteParams","matcherParams","dynamicRouteMatcher","assign","curParamsResult","routeMatchesHeader","routeMatches","getParamsFromRouteMatches","defaultRouteMatches","interpolateDynamicPath","normalizeCdnUrl","defaultRouteRegex","groups","renderError","webServerConfig","protocol","parsedFullUrl","incrementalCache","getIncrementalCache","requestHeaders","requestProtocol","resetRequestCache","__incrementalCache","cacheHandlers","Promise","all","cacheHandler","previouslyRevalidatedTags","previewModeId","receiveExpiredTags","invokePath","useInvokePath","invokeStatus","invokeQuery","parsedMatchedPath","invokePathnameInfo","parseData","normalizeResult","response","Response","bubble","run","code","getRequestHandlerWithMetadata","meta","handler","getRequestHandler","prefix","loadInstrumentationModule","prepareImpl","then","close","forEach","entry","normalizedPath","runImpl","pipe","fn","partialContext","pipeImpl","ua","botType","serveStreamingMetadata","payload","originalStatus","type","cacheControl","sent","setHeader","expire","sendRenderResult","getStaticHTML","toUnchunkedString","render","internalRender","renderImpl","getWaitUntil","builtinRequestContext","waitUntil","getInternalWaitUntil","startsWith","customServer","hasPage","renderToResponse","getStaticPaths","fallbackField","dynamicRoutes","staticPaths","fallbackMode","renderToResponseWithComponents","requestContext","findComponentsResult","renderToResponseWithComponentsImpl","pathCouldBeIntercepted","resolvedPathname","some","regexp","test","setVaryHeader","isAppPath","addedNextUrlToVary","appendHeader","opts","components","prerenderManifest","cacheEntry","isErrorPathname","is404Page","is500Page","hasServerProps","getServerSideProps","hasGetStaticPaths","isPossibleServerAction","hasGetInitialProps","Component","getInitialProps","isSSG","getStaticProps","resolvedUrlPathname","hasFallback","isDynamic","pathsResult","resolvedWithoutSlash","includes","routes","isNextDataRequest","isPrefetchRSCRequest","routeModule","couldSupportPPR","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","renderingMode","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","isDynamicRSCRequest","segmentPrefetchHeader","isHtmlBot","parseInt","slice","fromStatic","isBotRequest","isSupportedDocument","Document","previewData","isPreviewMode","tryGetPreviewData","multiZoneDraftMode","runtime","isOnDemandRevalidate","revalidateOnlyGenerated","handleRedirect","pageData","destination","pageProps","__N_REDIRECT","__N_REDIRECT_STATUS","__N_REDIRECT_BASE_PATH","ssgCacheKey","doRender","pagesFallback","fallbackRouteParams","origQuery","hadTrailingSlash","resolvedUrl","shouldWaitOnAllReady","isRevalidate","serverActions","resolvedAsPath","isDraftMode","onClose","onAfterTaskError","setIsrStatus","nextExport","isStaticGeneration","context","sharedContext","request","fromNodeNextRequest","handle","fetchMetrics","cacheTags","collectedTags","blob","revalidate","collectedRevalidate","collectedExpire","APP_ROUTE","status","from","arrayBuffer","isFallback","pendingWaitUntil","routerKind","routePath","routeType","revalidateReason","clientReferenceManifest","renderContext","developmentNotFoundSourcePage","module","warmup","metadata","devRenderResumeDataCache","renderHTML","fetchTags","staticBailoutInfo","description","stack","message","indexOf","isNotFound","isRedirect","REDIRECT","props","flightData","isNull","APP_PAGE","html","rscData","segmentData","PAGES","responseGenerator","hasResolved","previousCacheEntry","isRevalidating","isProduction","didRespond","NOT_FOUND","PRERENDER","BLOCKING_STATIC_RENDER","isStale","staticPathKey","isPageIncludedInStaticPaths","fallbackResponse","previousFallbackCacheEntry","routeKind","isPrefetch","purpose","DISABLE_ROUTE_SHELL_GENERATION","didPostpone","isMiss","cachedData","IMAGE","getHeader","notFoundRevalidate","tags","matchedSegment","onCacheEntry","JSON","stringify","delete","set","chain","ReadableStream","start","controller","enqueue","CLOSED","BODY_AND_HTML","transformer","TransformStream","readable","pipeTo","writable","catch","abort","e","stripLocale","splitPath","getOriginalAppPaths","originalAppPath","renderPageComponent","bubbleNoFallback","appPaths","findPageComponents","sriEnabled","sri","algorithm","shouldEnsure","setRootSpanAttribute","isNoFallbackError","renderToResponseImpl","fromRequest","matchAll","invokeOutput","initUrl","rewroteUrl","renderErrorToResponse","isWrappedError","renderToHTML","renderToHTMLImpl","setHeaders","renderErrorImpl","renderErrorToResponseImpl","is404","using404Page","statusPage","NODE_ENV","maybeFallbackError","render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AG,EAAG;QAEvE,uDAAuD;QACvD,IAAI,IAAI,CAACzB,UAAU,CAACuF,IAAI,EAAE;YACxB,IAAI,CAACrK,eAAesF,KAAK,WAAW;gBAClCvF,eAAeuF,KAAK,UAAU,IAAI,CAACR,UAAU,CAACuF,IAAI,CAACpC,aAAa;YAClE;YACAlI,eAAeuF,KAAK,iBAAiB,IAAI,CAACR,UAAU,CAACuF,IAAI,CAACpC,aAAa;QACzE;QAEAvB,IAAIsK,UAAU,GAAG;QACjB,OAAO,IAAI,CAACkF,WAAW,CAAC,MAAM5Q,KAAKoB,KAAKjB,UAAWsM,OAAO8V;IAC5D;AACF","ignoreList":[0]}
|
1
|
+
{"version":3,"sources":["../../src/server/base-server.ts"],"sourcesContent":["import type { __ApiPreviewProps } from './api-utils'\nimport type { LoadComponentsReturnType } from './load-components'\nimport type { MiddlewareRouteMatch } from '../shared/lib/router/utils/middleware-route-matcher'\nimport type { Params } from './request/params'\nimport {\n type FallbackRouteParams,\n getFallbackRouteParams,\n} from './request/fallback-params'\nimport type { NextConfig, NextConfigComplete } from './config-shared'\nimport type {\n NextParsedUrlQuery,\n NextUrlWithParsedQuery,\n RequestMeta,\n} from './request-meta'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { RenderOptsPartial as PagesRenderOptsPartial } from './render'\nimport type {\n RenderOptsPartial as AppRenderOptsPartial,\n ServerOnInstrumentationRequestError,\n} from './app-render/types'\nimport {\n type CachedAppPageValue,\n type CachedPageValue,\n type ServerComponentsHmrCache,\n type ResponseCacheBase,\n type ResponseCacheEntry,\n type ResponseGenerator,\n CachedRouteKind,\n type CachedRedirectValue,\n} from './response-cache'\nimport type { UrlWithParsedQuery } from 'url'\nimport {\n NormalizeError,\n DecodeError,\n normalizeRepeatedSlashes,\n MissingStaticPage,\n} from '../shared/lib/utils'\nimport type { PreviewData } from '../types'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\nimport type { BaseNextRequest, BaseNextResponse } from './base-http'\nimport type {\n ManifestRewriteRoute,\n ManifestRoute,\n PrerenderManifest,\n} from '../build'\nimport type { ClientReferenceManifest } from '../build/webpack/plugins/flight-manifest-plugin'\nimport type { NextFontManifest } from '../build/webpack/plugins/next-font-manifest-plugin'\nimport type {\n AppPageRouteHandlerContext,\n AppPageRouteModule,\n} from './route-modules/app-page/module'\nimport type { PagesAPIRouteMatch } from './route-matches/pages-api-route-match'\nimport type { AppRouteRouteHandlerContext } from './route-modules/app-route/module'\nimport type {\n Server as HTTPServer,\n IncomingMessage,\n ServerResponse as HTTPServerResponse,\n} from 'http'\nimport type { MiddlewareMatcher } from '../build/analysis/get-page-static-info'\nimport type { TLSSocket } from 'tls'\nimport type { PathnameNormalizer } from './normalizers/request/pathname-normalizer'\nimport type { InstrumentationModule } from './instrumentation/types'\n\nimport { format as formatUrl, parse as parseUrl } from 'url'\nimport { formatHostname } from './lib/format-hostname'\nimport { getRedirectStatus } from '../lib/redirect-status'\nimport { isEdgeRuntime } from '../lib/is-edge-runtime'\nimport {\n APP_PATHS_MANIFEST,\n NEXT_BUILTIN_DOCUMENT,\n PAGES_MANIFEST,\n STATIC_STATUS_PAGES,\n UNDERSCORE_NOT_FOUND_ROUTE,\n UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n} from '../shared/lib/constants'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { checkIsOnDemandRevalidate } from './api-utils'\nimport { setConfig } from '../shared/lib/runtime-config.external'\nimport { getCacheControlHeader, type CacheControl } from './lib/cache-control'\nimport { execOnce } from '../shared/lib/utils'\nimport { isBlockedPage } from './utils'\nimport { getBotType, isBot } from '../shared/lib/router/utils/is-bot'\nimport RenderResult from './render-result'\nimport { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport * as Log from '../build/output/log'\nimport { getPreviouslyRevalidatedTags, getUtils } from './server-utils'\nimport isError, { getProperError } from '../lib/is-error'\nimport {\n addRequestMeta,\n getRequestMeta,\n removeRequestMeta,\n setRequestMeta,\n} from './request-meta'\nimport { removePathPrefix } from '../shared/lib/router/utils/remove-path-prefix'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\nimport { getHostname } from '../shared/lib/get-hostname'\nimport { parseUrl as parseUrlUtil } from '../shared/lib/router/utils/parse-url'\nimport { getNextPathnameInfo } from '../shared/lib/router/utils/get-next-pathname-info'\nimport {\n RSC_HEADER,\n NEXT_RSC_UNION_QUERY,\n NEXT_ROUTER_PREFETCH_HEADER,\n NEXT_ROUTER_SEGMENT_PREFETCH_HEADER,\n NEXT_DID_POSTPONE_HEADER,\n NEXT_URL,\n NEXT_IS_PRERENDER_HEADER,\n} from '../client/components/app-router-headers'\nimport type {\n MatchOptions,\n RouteMatcherManager,\n} from './route-matcher-managers/route-matcher-manager'\nimport { LocaleRouteNormalizer } from './normalizers/locale-route-normalizer'\nimport { DefaultRouteMatcherManager } from './route-matcher-managers/default-route-matcher-manager'\nimport { AppPageRouteMatcherProvider } from './route-matcher-providers/app-page-route-matcher-provider'\nimport { AppRouteRouteMatcherProvider } from './route-matcher-providers/app-route-route-matcher-provider'\nimport { PagesAPIRouteMatcherProvider } from './route-matcher-providers/pages-api-route-matcher-provider'\nimport { PagesRouteMatcherProvider } from './route-matcher-providers/pages-route-matcher-provider'\nimport { ServerManifestLoader } from './route-matcher-providers/helpers/manifest-loaders/server-manifest-loader'\nimport { getTracer, isBubbledError, SpanKind } from './lib/trace/tracer'\nimport { BaseServerSpan } from './lib/trace/constants'\nimport { I18NProvider } from './lib/i18n-provider'\nimport { sendResponse } from './send-response'\nimport {\n fromNodeOutgoingHttpHeaders,\n normalizeNextQueryParam,\n toNodeOutgoingHttpHeaders,\n} from './web/utils'\nimport {\n CACHE_ONE_YEAR,\n INFINITE_CACHE,\n MATCHED_PATH_HEADER,\n NEXT_CACHE_TAGS_HEADER,\n NEXT_RESUME_HEADER,\n} from '../lib/constants'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport {\n NextRequestAdapter,\n signalFromNodeResponse,\n} from './web/spec-extension/adapters/next-request'\nimport { matchNextDataPathname } from './lib/match-next-data-pathname'\nimport getRouteFromAssetPath from '../shared/lib/router/utils/get-route-from-asset-path'\nimport { decodePathParams } from './lib/router-utils/decode-path-params'\nimport { RSCPathnameNormalizer } from './normalizers/request/rsc'\nimport { stripFlightHeaders } from './app-render/strip-flight-headers'\nimport {\n isAppPageRouteModule,\n isAppRouteRouteModule,\n isPagesRouteModule,\n} from './route-modules/checks'\nimport { PrefetchRSCPathnameNormalizer } from './normalizers/request/prefetch-rsc'\nimport { NextDataPathnameNormalizer } from './normalizers/request/next-data'\nimport { getIsPossibleServerAction } from './lib/server-action-request-meta'\nimport { isInterceptionRouteAppPath } from '../shared/lib/router/utils/interception-routes'\nimport { toRoute } from './lib/to-route'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isNodeNextRequest, isNodeNextResponse } from './base-http/helpers'\nimport { patchSetHeaderWithCookieSupport } from './lib/patch-set-header'\nimport { checkIsAppPPREnabled } from './lib/experimental/ppr'\nimport {\n getBuiltinRequestContext,\n type WaitUntil,\n} from './after/builtin-request-context'\nimport { ENCODED_TAGS } from './stream-utils/encodedTags'\nimport { NextRequestHint } from './web/adapter'\nimport { getRevalidateReason } from './instrumentation/utils'\nimport { RouteKind } from './route-kind'\nimport type { RouteModule } from './route-modules/route-module'\nimport { FallbackMode, parseFallbackField } from '../lib/fallback'\nimport { toResponseCacheEntry } from './response-cache/utils'\nimport { scheduleOnNextTick } from '../lib/scheduler'\nimport { SegmentPrefixRSCPathnameNormalizer } from './normalizers/request/segment-prefix-rsc'\nimport {\n shouldServeStreamingMetadata,\n isHtmlBotRequest,\n} from './lib/streaming-metadata'\nimport { InvariantError } from '../shared/lib/invariant-error'\nimport { decodeQueryPathParameter } from './lib/decode-query-path-parameter'\nimport { getCacheHandlers } from './use-cache/handlers'\n\nexport type FindComponentsResult = {\n components: LoadComponentsReturnType\n query: NextParsedUrlQuery\n}\n\nexport interface MiddlewareRoutingItem {\n page: string\n match: MiddlewareRouteMatch\n matchers?: MiddlewareMatcher[]\n}\n\nexport type RouteHandler<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: NextUrlWithParsedQuery\n) => PromiseLike<boolean> | boolean\n\n/**\n * The normalized route manifest is the same as the route manifest, but with\n * the rewrites normalized to the object shape that the router expects.\n */\nexport type NormalizedRouteManifest = {\n readonly dynamicRoutes: ReadonlyArray<ManifestRoute>\n readonly rewrites: {\n readonly beforeFiles: ReadonlyArray<ManifestRewriteRoute>\n readonly afterFiles: ReadonlyArray<ManifestRewriteRoute>\n readonly fallback: ReadonlyArray<ManifestRewriteRoute>\n }\n}\n\nexport interface Options {\n /**\n * Object containing the configuration next.config.js\n */\n conf: NextConfig\n /**\n * Set to false when the server was created by Next.js\n */\n customServer?: boolean\n /**\n * Tells if Next.js is running in dev mode\n */\n dev?: boolean\n /**\n * Enables the experimental testing mode.\n */\n experimentalTestProxy?: boolean\n\n /**\n * Whether or not the dev server is running in experimental HTTPS mode\n */\n experimentalHttpsServer?: boolean\n /**\n * Where the Next project is located\n */\n dir?: string\n /**\n * Tells if Next.js is at the platform-level\n */\n minimalMode?: boolean\n /**\n * Hide error messages containing server information\n */\n quiet?: boolean\n /**\n * The hostname the server is running behind\n */\n hostname?: string\n /**\n * The port the server is running behind\n */\n port?: number\n /**\n * The HTTP Server that Next.js is running behind\n */\n httpServer?: HTTPServer\n}\n\nexport type RenderOpts = PagesRenderOptsPartial & AppRenderOptsPartial\n\nexport type LoadedRenderOpts = RenderOpts &\n LoadComponentsReturnType &\n RequestLifecycleOpts\n\nexport type RequestLifecycleOpts = {\n waitUntil: ((promise: Promise<any>) => void) | undefined\n onClose: (callback: () => void) => void\n onAfterTaskError: ((error: unknown) => void) | undefined\n}\n\ntype BaseRenderOpts = RenderOpts & {\n poweredByHeader: boolean\n generateEtags: boolean\n previewProps: __ApiPreviewProps\n}\n\n/**\n * The public interface for rendering with the server programmatically. This\n * would typically only allow the base request or response to extend it, but\n * because this can be programmatically accessed, we assume that it could also\n * be the base Node.js request and response types.\n */\nexport interface BaseRequestHandler<\n ServerRequest extends BaseNextRequest | IncomingMessage = BaseNextRequest,\n ServerResponse extends\n | BaseNextResponse\n | HTTPServerResponse = BaseNextResponse,\n> {\n (\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery | undefined\n ): Promise<void> | void\n}\n\nexport type RequestContext<\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> = {\n req: ServerRequest\n res: ServerResponse\n pathname: string\n query: NextParsedUrlQuery\n renderOpts: RenderOpts\n}\n\nexport class NoFallbackError extends Error {}\n\n// Internal wrapper around build errors at development\n// time, to prevent us from propagating or logging them\nexport class WrappedBuildError extends Error {\n innerError: Error\n\n constructor(innerError: Error) {\n super()\n this.innerError = innerError\n }\n}\n\ntype ResponsePayload = {\n type: 'html' | 'json' | 'rsc'\n body: RenderResult\n cacheControl?: CacheControl\n}\n\nexport type NextEnabledDirectories = {\n readonly pages: boolean\n readonly app: boolean\n}\n\nexport default abstract class Server<\n ServerOptions extends Options = Options,\n ServerRequest extends BaseNextRequest = BaseNextRequest,\n ServerResponse extends BaseNextResponse = BaseNextResponse,\n> {\n public readonly hostname?: string\n public readonly fetchHostname?: string\n public readonly port?: number\n protected readonly dir: string\n protected readonly quiet: boolean\n protected readonly nextConfig: NextConfigComplete\n protected readonly distDir: string\n protected readonly publicDir: string\n protected readonly hasStaticDir: boolean\n protected readonly pagesManifest?: PagesManifest\n protected readonly appPathsManifest?: PagesManifest\n protected readonly buildId: string\n protected readonly minimalMode: boolean\n protected readonly renderOpts: BaseRenderOpts\n protected readonly serverOptions: Readonly<ServerOptions>\n protected readonly appPathRoutes?: Record<string, string[]>\n protected readonly clientReferenceManifest?: DeepReadonly<ClientReferenceManifest>\n protected interceptionRoutePatterns: RegExp[]\n protected nextFontManifest?: DeepReadonly<NextFontManifest>\n protected instrumentation: InstrumentationModule | undefined\n private readonly responseCache: ResponseCacheBase\n\n protected abstract getPublicDir(): string\n protected abstract getHasStaticDir(): boolean\n protected abstract getPagesManifest(): PagesManifest | undefined\n protected abstract getAppPathsManifest(): PagesManifest | undefined\n protected abstract getBuildId(): string\n protected abstract getinterceptionRoutePatterns(): RegExp[]\n\n protected readonly enabledDirectories: NextEnabledDirectories\n protected abstract getEnabledDirectories(dev: boolean): NextEnabledDirectories\n\n protected readonly experimentalTestProxy?: boolean\n\n protected abstract findPageComponents(params: {\n locale: string | undefined\n page: string\n query: NextParsedUrlQuery\n params: Params\n isAppPath: boolean\n // The following parameters are used in the development server's\n // implementation.\n sriEnabled?: boolean\n appPaths?: ReadonlyArray<string> | null\n shouldEnsure?: boolean\n url?: string\n }): Promise<FindComponentsResult | null>\n protected abstract getPrerenderManifest(): DeepReadonly<PrerenderManifest>\n protected abstract getNextFontManifest():\n | DeepReadonly<NextFontManifest>\n | undefined\n protected abstract attachRequestMeta(\n req: ServerRequest,\n parsedUrl: NextUrlWithParsedQuery\n ): void\n protected abstract hasPage(pathname: string): Promise<boolean>\n\n protected abstract sendRenderResult(\n req: ServerRequest,\n res: ServerResponse,\n options: {\n result: RenderResult\n type: 'html' | 'json' | 'rsc'\n generateEtags: boolean\n poweredByHeader: boolean\n cacheControl: CacheControl | undefined\n }\n ): Promise<void>\n\n protected abstract runApi(\n req: ServerRequest,\n res: ServerResponse,\n query: ParsedUrlQuery,\n match: PagesAPIRouteMatch\n ): Promise<boolean>\n\n protected abstract renderHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery,\n renderOpts: LoadedRenderOpts\n ): Promise<RenderResult>\n\n protected abstract getIncrementalCache(options: {\n requestHeaders: Record<string, undefined | string | string[]>\n requestProtocol: 'http' | 'https'\n }): Promise<import('./lib/incremental-cache').IncrementalCache>\n\n protected abstract getResponseCache(options: {\n dev: boolean\n }): ResponseCacheBase\n\n protected getServerComponentsHmrCache():\n | ServerComponentsHmrCache\n | undefined {\n return this.nextConfig.experimental.serverComponentsHmrCache\n ? (globalThis as any).__serverComponentsHmrCache\n : undefined\n }\n\n protected abstract loadEnvConfig(params: {\n dev: boolean\n forceReload?: boolean\n }): void\n\n // TODO-APP: (wyattjoh): Make protected again. Used for turbopack in route-resolver.ts right now.\n public readonly matchers: RouteMatcherManager\n protected readonly i18nProvider?: I18NProvider\n protected readonly localeNormalizer?: LocaleRouteNormalizer\n\n protected readonly normalizers: {\n readonly rsc: RSCPathnameNormalizer | undefined\n readonly prefetchRSC: PrefetchRSCPathnameNormalizer | undefined\n readonly segmentPrefetchRSC: SegmentPrefixRSCPathnameNormalizer | undefined\n readonly data: NextDataPathnameNormalizer | undefined\n }\n\n private readonly isAppPPREnabled: boolean\n private readonly isAppSegmentPrefetchEnabled: boolean\n\n /**\n * This is used to persist cache scopes across\n * prefetch -> full route requests for dynamic IO\n * it's only fully used in dev\n */\n\n public constructor(options: ServerOptions) {\n const {\n dir = '.',\n quiet = false,\n conf,\n dev = false,\n minimalMode = false,\n hostname,\n port,\n experimentalTestProxy,\n } = options\n\n this.experimentalTestProxy = experimentalTestProxy\n this.serverOptions = options\n\n this.dir =\n process.env.NEXT_RUNTIME === 'edge' ? dir : require('path').resolve(dir)\n\n this.quiet = quiet\n this.loadEnvConfig({ dev })\n\n // TODO: should conf be normalized to prevent missing\n // values from causing issues as this can be user provided\n this.nextConfig = conf as NextConfigComplete\n this.hostname = hostname\n if (this.hostname) {\n // we format the hostname so that it can be fetched\n this.fetchHostname = formatHostname(this.hostname)\n }\n this.port = port\n this.distDir =\n process.env.NEXT_RUNTIME === 'edge'\n ? this.nextConfig.distDir\n : require('path').join(this.dir, this.nextConfig.distDir)\n this.publicDir = this.getPublicDir()\n this.hasStaticDir = !minimalMode && this.getHasStaticDir()\n\n this.i18nProvider = this.nextConfig.i18n?.locales\n ? new I18NProvider(this.nextConfig.i18n)\n : undefined\n\n // Configure the locale normalizer, it's used for routes inside `pages/`.\n this.localeNormalizer = this.i18nProvider\n ? new LocaleRouteNormalizer(this.i18nProvider)\n : undefined\n\n // Only serverRuntimeConfig needs the default\n // publicRuntimeConfig gets it's default in client/index.js\n const {\n serverRuntimeConfig = {},\n publicRuntimeConfig,\n assetPrefix,\n generateEtags,\n } = this.nextConfig\n\n this.buildId = this.getBuildId()\n // this is a hack to avoid Webpack knowing this is equal to this.minimalMode\n // because we replace this.minimalMode to true in production bundles.\n const minimalModeKey = 'minimalMode'\n this[minimalModeKey] =\n minimalMode || !!process.env.NEXT_PRIVATE_MINIMAL_MODE\n\n this.enabledDirectories = this.getEnabledDirectories(dev)\n\n this.isAppPPREnabled =\n this.enabledDirectories.app &&\n checkIsAppPPREnabled(this.nextConfig.experimental.ppr)\n\n this.isAppSegmentPrefetchEnabled =\n this.enabledDirectories.app &&\n this.nextConfig.experimental.clientSegmentCache === true\n\n this.normalizers = {\n // We should normalize the pathname from the RSC prefix only in minimal\n // mode as otherwise that route is not exposed external to the server as\n // we instead only rely on the headers.\n rsc:\n this.enabledDirectories.app && this.minimalMode\n ? new RSCPathnameNormalizer()\n : undefined,\n prefetchRSC:\n this.isAppPPREnabled && this.minimalMode\n ? new PrefetchRSCPathnameNormalizer()\n : undefined,\n segmentPrefetchRSC:\n this.isAppSegmentPrefetchEnabled && this.minimalMode\n ? new SegmentPrefixRSCPathnameNormalizer()\n : undefined,\n data: this.enabledDirectories.pages\n ? new NextDataPathnameNormalizer(this.buildId)\n : undefined,\n }\n\n this.nextFontManifest = this.getNextFontManifest()\n\n if (process.env.NEXT_RUNTIME !== 'edge') {\n process.env.NEXT_DEPLOYMENT_ID = this.nextConfig.deploymentId || ''\n }\n\n this.renderOpts = {\n supportsDynamicResponse: true,\n trailingSlash: this.nextConfig.trailingSlash,\n deploymentId: this.nextConfig.deploymentId,\n strictNextHead: this.nextConfig.experimental.strictNextHead ?? true,\n poweredByHeader: this.nextConfig.poweredByHeader,\n canonicalBase: this.nextConfig.amp.canonicalBase || '',\n generateEtags,\n previewProps: this.getPrerenderManifest().preview,\n ampOptimizerConfig: this.nextConfig.experimental.amp?.optimizer,\n basePath: this.nextConfig.basePath,\n images: this.nextConfig.images,\n optimizeCss: this.nextConfig.experimental.optimizeCss,\n nextConfigOutput: this.nextConfig.output,\n nextScriptWorkers: this.nextConfig.experimental.nextScriptWorkers,\n disableOptimizedLoading:\n this.nextConfig.experimental.disableOptimizedLoading,\n domainLocales: this.nextConfig.i18n?.domains,\n distDir: this.distDir,\n serverComponents: this.enabledDirectories.app,\n cacheLifeProfiles: this.nextConfig.experimental.cacheLife,\n enableTainting: this.nextConfig.experimental.taint,\n crossOrigin: this.nextConfig.crossOrigin\n ? this.nextConfig.crossOrigin\n : undefined,\n largePageDataBytes: this.nextConfig.experimental.largePageDataBytes,\n // Only the `publicRuntimeConfig` key is exposed to the client side\n // It'll be rendered as part of __NEXT_DATA__ on the client side\n runtimeConfig:\n Object.keys(publicRuntimeConfig).length > 0\n ? publicRuntimeConfig\n : undefined,\n\n // @ts-expect-error internal field not publicly exposed\n isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile,\n // `htmlLimitedBots` is passed to server as serialized config in string format\n htmlLimitedBots: this.nextConfig.htmlLimitedBots,\n experimental: {\n expireTime: this.nextConfig.expireTime,\n clientTraceMetadata: this.nextConfig.experimental.clientTraceMetadata,\n dynamicIO: this.nextConfig.experimental.dynamicIO ?? false,\n clientSegmentCache:\n this.nextConfig.experimental.clientSegmentCache === 'client-only'\n ? 'client-only'\n : Boolean(this.nextConfig.experimental.clientSegmentCache),\n dynamicOnHover: this.nextConfig.experimental.dynamicOnHover ?? false,\n inlineCss: this.nextConfig.experimental.inlineCss ?? false,\n authInterrupts: !!this.nextConfig.experimental.authInterrupts,\n },\n onInstrumentationRequestError:\n this.instrumentationOnRequestError.bind(this),\n reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength,\n }\n\n // Initialize next/config with the environment configuration\n setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig,\n })\n\n this.pagesManifest = this.getPagesManifest()\n this.appPathsManifest = this.getAppPathsManifest()\n this.appPathRoutes = this.getAppPathRoutes()\n this.interceptionRoutePatterns = this.getinterceptionRoutePatterns()\n\n // Configure the routes.\n this.matchers = this.getRouteMatchers()\n\n // Start route compilation. We don't wait for the routes to finish loading\n // because we use the `waitTillReady` promise below in `handleRequest` to\n // wait. Also we can't `await` in the constructor.\n void this.matchers.reload()\n\n this.setAssetPrefix(assetPrefix)\n this.responseCache = this.getResponseCache({ dev })\n }\n\n protected reloadMatchers() {\n return this.matchers.reload()\n }\n\n private handleRSCRequest: RouteHandler<ServerRequest, ServerResponse> = (\n req,\n _res,\n parsedUrl\n ) => {\n if (!parsedUrl.pathname) return false\n\n if (this.normalizers.segmentPrefetchRSC?.match(parsedUrl.pathname)) {\n const result = this.normalizers.segmentPrefetchRSC.extract(\n parsedUrl.pathname\n )\n if (!result) return false\n\n const { originalPathname, segmentPath } = result\n parsedUrl.pathname = originalPathname\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()] =\n segmentPath\n\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n addRequestMeta(req, 'segmentPrefetchRSCRequest', segmentPath)\n } else if (this.normalizers.prefetchRSC?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.prefetchRSC.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a router prefetch request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n } else if (this.normalizers.rsc?.match(parsedUrl.pathname)) {\n parsedUrl.pathname = this.normalizers.rsc.normalize(\n parsedUrl.pathname,\n true\n )\n\n // Mark the request as a RSC request.\n req.headers[RSC_HEADER.toLowerCase()] = '1'\n addRequestMeta(req, 'isRSCRequest', true)\n } else if (req.headers['x-now-route-matches']) {\n // If we didn't match, return with the flight headers stripped. If in\n // minimal mode we didn't match based on the path, this can't be a RSC\n // request. This is because Vercel only sends this header during\n // revalidation requests and we want the cache to instead depend on the\n // request path for flight information.\n stripFlightHeaders(req.headers)\n\n return false\n } else if (req.headers[RSC_HEADER.toLowerCase()] === '1') {\n addRequestMeta(req, 'isRSCRequest', true)\n\n if (req.headers[NEXT_ROUTER_PREFETCH_HEADER.toLowerCase()] === '1') {\n addRequestMeta(req, 'isPrefetchRSCRequest', true)\n\n const segmentPrefetchRSCRequest =\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()]\n if (typeof segmentPrefetchRSCRequest === 'string') {\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n } else {\n // Otherwise just return without doing anything.\n return false\n }\n\n if (req.url) {\n const parsed = parseUrl(req.url)\n parsed.pathname = parsedUrl.pathname\n req.url = formatUrl(parsed)\n }\n\n return false\n }\n\n private handleNextDataRequest: RouteHandler<ServerRequest, ServerResponse> =\n async (req, res, parsedUrl) => {\n const middleware = await this.getMiddleware()\n const params = matchNextDataPathname(parsedUrl.pathname)\n\n // ignore for non-next data URLs\n if (!params || !params.path) {\n return false\n }\n\n if (params.path[0] !== this.buildId) {\n // Ignore if its a middleware request when we aren't on edge.\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n getRequestMeta(req, 'middlewareInvoke')\n ) {\n return false\n }\n\n // Make sure to 404 if the buildId isn't correct\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // remove buildId from URL\n params.path.shift()\n\n const lastParam = params.path[params.path.length - 1]\n\n // show 404 if it doesn't end with .json\n if (typeof lastParam !== 'string' || !lastParam.endsWith('.json')) {\n await this.render404(req, res, parsedUrl)\n return true\n }\n\n // re-create page's pathname\n let pathname = `/${params.path.join('/')}`\n pathname = getRouteFromAssetPath(pathname, '.json')\n\n // ensure trailing slash is normalized per config\n if (middleware) {\n if (this.nextConfig.trailingSlash && !pathname.endsWith('/')) {\n pathname += '/'\n }\n if (\n !this.nextConfig.trailingSlash &&\n pathname.length > 1 &&\n pathname.endsWith('/')\n ) {\n pathname = pathname.substring(0, pathname.length - 1)\n }\n }\n\n if (this.i18nProvider) {\n // Remove the port from the hostname if present.\n const hostname = req?.headers.host?.split(':', 1)[0].toLowerCase()\n\n const domainLocale = this.i18nProvider.detectDomainLocale(hostname)\n const defaultLocale =\n domainLocale?.defaultLocale ?? this.i18nProvider.config.defaultLocale\n\n const localePathResult = this.i18nProvider.analyze(pathname)\n\n // If the locale is detected from the path, we need to remove it\n // from the pathname.\n if (localePathResult.detectedLocale) {\n pathname = localePathResult.pathname\n }\n\n // Update the query with the detected locale and default locale.\n addRequestMeta(req, 'locale', localePathResult.detectedLocale)\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n // If the locale is not detected from the path, we need to mark that\n // it was not inferred from default.\n if (!localePathResult.detectedLocale) {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n\n // If no locale was detected and we don't have middleware, we need\n // to render a 404 page.\n if (!localePathResult.detectedLocale && !middleware) {\n addRequestMeta(req, 'locale', defaultLocale)\n await this.render404(req, res, parsedUrl)\n return true\n }\n }\n\n parsedUrl.pathname = pathname\n addRequestMeta(req, 'isNextDataReq', true)\n\n return false\n }\n\n protected handleNextImageRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallRenderRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected handleCatchallMiddlewareRequest: RouteHandler<\n ServerRequest,\n ServerResponse\n > = () => false\n\n protected getRouteMatchers(): RouteMatcherManager {\n // Create a new manifest loader that get's the manifests from the server.\n const manifestLoader = new ServerManifestLoader((name) => {\n switch (name) {\n case PAGES_MANIFEST:\n return this.getPagesManifest() ?? null\n case APP_PATHS_MANIFEST:\n return this.getAppPathsManifest() ?? null\n default:\n return null\n }\n })\n\n // Configure the matchers and handlers.\n const matchers: RouteMatcherManager = new DefaultRouteMatcherManager()\n\n // Match pages under `pages/`.\n matchers.push(\n new PagesRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // Match api routes under `pages/api/`.\n matchers.push(\n new PagesAPIRouteMatcherProvider(\n this.distDir,\n manifestLoader,\n this.i18nProvider\n )\n )\n\n // If the app directory is enabled, then add the app matchers and handlers.\n if (this.enabledDirectories.app) {\n // Match app pages under `app/`.\n matchers.push(\n new AppPageRouteMatcherProvider(this.distDir, manifestLoader)\n )\n matchers.push(\n new AppRouteRouteMatcherProvider(this.distDir, manifestLoader)\n )\n }\n\n return matchers\n }\n\n protected async instrumentationOnRequestError(\n ...args: Parameters<ServerOnInstrumentationRequestError>\n ) {\n const [err, req, ctx] = args\n\n if (this.instrumentation) {\n try {\n await this.instrumentation.onRequestError?.(\n err,\n {\n path: req.url || '',\n method: req.method || 'GET',\n // Normalize middleware headers and other server request headers\n headers:\n req instanceof NextRequestHint\n ? Object.fromEntries(req.headers.entries())\n : req.headers,\n },\n ctx\n )\n } catch (handlerErr) {\n // Log the soft error and continue, since errors can thrown from react stream handler\n console.error('Error in instrumentation.onRequestError:', handlerErr)\n }\n }\n }\n\n public logError(err: Error): void {\n if (this.quiet) return\n Log.error(err)\n }\n\n public async handleRequest(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise<void> {\n await this.prepare()\n const method = req.method.toUpperCase()\n\n const tracer = getTracer()\n return tracer.withPropagatedContext(req.headers, () => {\n return tracer.trace(\n BaseServerSpan.handleRequest,\n {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url,\n },\n },\n async (span) =>\n this.handleRequestImpl(req, res, parsedUrl).finally(() => {\n if (!span) return\n\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': isRSCRequest,\n })\n\n const rootSpanAttributes = tracer.getRootSpanAttributes()\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) return\n\n if (\n rootSpanAttributes.get('next.span_type') !==\n BaseServerSpan.handleRequest\n ) {\n console.warn(\n `Unexpected root span type '${rootSpanAttributes.get(\n 'next.span_type'\n )}'. Please report this Next.js issue https://github.com/vercel/next.js`\n )\n return\n }\n\n const route = rootSpanAttributes.get('next.route')\n if (route) {\n const name = isRSCRequest\n ? `RSC ${method} ${route}`\n : `${method} ${route}`\n\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name,\n })\n span.updateName(name)\n } else {\n span.updateName(\n isRSCRequest\n ? `RSC ${method} ${req.url}`\n : `${method} ${req.url}`\n )\n }\n })\n )\n })\n }\n\n private async handleRequestImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: NextUrlWithParsedQuery\n ): Promise<void> {\n try {\n // Wait for the matchers to be ready.\n await this.matchers.waitTillReady()\n\n // ensure cookies set in middleware are merged and\n // not overridden by API routes/getServerSideProps\n patchSetHeaderWithCookieSupport(\n req,\n isNodeNextResponse(res) ? res.originalResponse : res\n )\n\n const urlParts = (req.url || '').split('?', 1)\n const urlNoQuery = urlParts[0]\n\n // this normalizes repeated slashes in the path e.g. hello//world ->\n // hello/world or backslashes to forward slashes, this does not\n // handle trailing slash as that is handled the same as a next.config.js\n // redirect\n if (urlNoQuery?.match(/(\\\\|\\/\\/)/)) {\n const cleanUrl = normalizeRepeatedSlashes(req.url!)\n res.redirect(cleanUrl, 308).body(cleanUrl).send()\n return\n }\n\n // Parse url if parsedUrl not provided\n if (!parsedUrl || typeof parsedUrl !== 'object') {\n if (!req.url) {\n throw new Error('Invariant: url can not be undefined')\n }\n\n parsedUrl = parseUrl(req.url!, true)\n }\n\n if (!parsedUrl.pathname) {\n throw new Error(\"Invariant: pathname can't be empty\")\n }\n\n // Parse the querystring ourselves if the user doesn't handle querystring parsing\n if (typeof parsedUrl.query === 'string') {\n parsedUrl.query = Object.fromEntries(\n new URLSearchParams(parsedUrl.query)\n )\n }\n\n // Update the `x-forwarded-*` headers.\n const { originalRequest = null } = isNodeNextRequest(req) ? req : {}\n const xForwardedProto = originalRequest?.headers['x-forwarded-proto']\n const isHttps = xForwardedProto\n ? xForwardedProto === 'https'\n : !!(originalRequest?.socket as TLSSocket)?.encrypted\n\n req.headers['x-forwarded-host'] ??= req.headers['host'] ?? this.hostname\n req.headers['x-forwarded-port'] ??= this.port\n ? this.port.toString()\n : isHttps\n ? '443'\n : '80'\n req.headers['x-forwarded-proto'] ??= isHttps ? 'https' : 'http'\n req.headers['x-forwarded-for'] ??= originalRequest?.socket?.remoteAddress\n\n // This should be done before any normalization of the pathname happens as\n // it captures the initial URL.\n this.attachRequestMeta(req, parsedUrl)\n\n let finished = await this.handleRSCRequest(req, res, parsedUrl)\n if (finished) return\n\n const domainLocale = this.i18nProvider?.detectDomainLocale(\n getHostname(parsedUrl, req.headers)\n )\n\n const defaultLocale =\n domainLocale?.defaultLocale || this.nextConfig.i18n?.defaultLocale\n addRequestMeta(req, 'defaultLocale', defaultLocale)\n\n const url = parseUrlUtil(req.url.replace(/^\\/+/, '/'))\n const pathnameInfo = getNextPathnameInfo(url.pathname, {\n nextConfig: this.nextConfig,\n i18nProvider: this.i18nProvider,\n })\n url.pathname = pathnameInfo.pathname\n\n if (pathnameInfo.basePath) {\n req.url = removePathPrefix(req.url!, this.nextConfig.basePath)\n }\n\n const useMatchedPathHeader =\n this.minimalMode && typeof req.headers[MATCHED_PATH_HEADER] === 'string'\n\n // TODO: merge handling with invokePath\n if (useMatchedPathHeader) {\n try {\n if (this.enabledDirectories.app) {\n // ensure /index path is normalized for prerender\n // in minimal mode\n if (req.url.match(/^\\/index($|\\?)/)) {\n req.url = req.url.replace(/^\\/index/, '/')\n }\n parsedUrl.pathname =\n parsedUrl.pathname === '/index' ? '/' : parsedUrl.pathname\n }\n\n // x-matched-path is the source of truth, it tells what page\n // should be rendered because we don't process rewrites in minimalMode\n let { pathname: matchedPath } = new URL(\n req.headers[MATCHED_PATH_HEADER] as string,\n 'http://localhost'\n )\n\n let { pathname: urlPathname } = new URL(req.url, 'http://localhost')\n\n // For ISR the URL is normalized to the prerenderPath so if\n // it's a data request the URL path will be the data URL,\n // basePath is already stripped by this point\n if (this.normalizers.data?.match(urlPathname)) {\n addRequestMeta(req, 'isNextDataReq', true)\n }\n // In minimal mode, if PPR is enabled, then we should check to see if\n // the request should be a resume request.\n else if (\n this.isAppPPREnabled &&\n this.minimalMode &&\n req.headers[NEXT_RESUME_HEADER] === '1' &&\n req.method === 'POST'\n ) {\n // Decode the postponed state from the request body, it will come as\n // an array of buffers, so collect them and then concat them to form\n // the string.\n const body: Array<Buffer> = []\n for await (const chunk of req.body) {\n body.push(chunk)\n }\n const postponed = Buffer.concat(body).toString('utf8')\n\n addRequestMeta(req, 'postponed', postponed)\n }\n\n matchedPath = this.normalize(matchedPath)\n const normalizedUrlPath = this.stripNextDataPath(urlPathname)\n\n matchedPath = denormalizePagePath(matchedPath)\n\n // Perform locale detection and normalization.\n const localeAnalysisResult = this.i18nProvider?.analyze(matchedPath, {\n defaultLocale,\n })\n\n // The locale result will be defined even if the locale was not\n // detected for the request because it will be inferred from the\n // default locale.\n if (localeAnalysisResult) {\n addRequestMeta(req, 'locale', localeAnalysisResult.detectedLocale)\n\n // If the detected locale was inferred from the default locale, we\n // need to modify the metadata on the request to indicate that.\n if (localeAnalysisResult.inferredFromDefault) {\n addRequestMeta(req, 'localeInferredFromDefault', true)\n } else {\n removeRequestMeta(req, 'localeInferredFromDefault')\n }\n }\n\n let srcPathname = matchedPath\n let pageIsDynamic = isDynamicRoute(srcPathname)\n let paramsResult: {\n params: ParsedUrlQuery | false\n hasValidParams: boolean\n } = {\n params: false,\n hasValidParams: false,\n }\n\n if (!pageIsDynamic) {\n const match = await this.matchers.match(srcPathname, {\n i18n: localeAnalysisResult,\n })\n\n // Update the source pathname to the matched page's pathname.\n if (match) {\n srcPathname = match.definition.pathname\n\n // The page is dynamic if the params are defined. We know at this\n // stage that the matched path is not a static page if the params\n // were parsed from the matched path header.\n if (typeof match.params !== 'undefined') {\n pageIsDynamic = true\n paramsResult.params = match.params\n paramsResult.hasValidParams = true\n }\n }\n }\n\n // The rest of this function can't handle i18n properly, so ensure we\n // restore the pathname with the locale information stripped from it\n // now that we're done matching if we're using i18n.\n if (localeAnalysisResult) {\n matchedPath = localeAnalysisResult.pathname\n }\n\n const utils = getUtils({\n pageIsDynamic,\n page: srcPathname,\n i18n: this.nextConfig.i18n,\n basePath: this.nextConfig.basePath,\n rewrites: this.getRoutesManifest()?.rewrites || {\n beforeFiles: [],\n afterFiles: [],\n fallback: [],\n },\n caseSensitive: !!this.nextConfig.experimental.caseSensitiveRoutes,\n })\n\n // Ensure parsedUrl.pathname includes locale before processing\n // rewrites or they won't match correctly.\n if (defaultLocale && !pathnameInfo.locale) {\n parsedUrl.pathname = `/${defaultLocale}${parsedUrl.pathname}`\n }\n\n // Store a copy of `parsedUrl.query` before calling handleRewrites.\n // Since `handleRewrites` might add new queries to `parsedUrl.query`.\n const originQueryParams = { ...parsedUrl.query }\n\n const pathnameBeforeRewrite = parsedUrl.pathname\n const rewriteParamKeys = Object.keys(\n utils.handleRewrites(req, parsedUrl)\n )\n\n // Create a copy of the query params to avoid mutating the original\n // object. This prevents any overlapping query params that have the\n // same normalized key from causing issues.\n const queryParams = { ...parsedUrl.query }\n const didRewrite = pathnameBeforeRewrite !== parsedUrl.pathname\n\n if (didRewrite && parsedUrl.pathname) {\n addRequestMeta(req, 'rewroteURL', parsedUrl.pathname)\n }\n\n const routeParamKeys = new Set<string>()\n for (const [key, value] of Object.entries(parsedUrl.query)) {\n const normalizedKey = normalizeNextQueryParam(key)\n if (!normalizedKey) continue\n\n // Remove the prefixed key from the query params because we want\n // to consume it for the dynamic route matcher.\n delete parsedUrl.query[key]\n routeParamKeys.add(normalizedKey)\n\n if (typeof value === 'undefined') continue\n\n queryParams[normalizedKey] = Array.isArray(value)\n ? value.map((v) => decodeQueryPathParameter(v))\n : decodeQueryPathParameter(value)\n }\n\n // interpolate dynamic params and normalize URL if needed\n if (pageIsDynamic) {\n let params: ParsedUrlQuery | false = {}\n\n // ensure we normalize the dynamic route params for encoding/\n // default values\n paramsResult = utils.normalizeDynamicRouteParams(queryParams, false)\n\n // for prerendered ISR paths we attempt parsing the route\n // params from the URL directly as route-matches may not\n // contain the correct values due to the filesystem path\n // matching before the dynamic route has been matched\n if (\n !paramsResult.hasValidParams &&\n !isDynamicRoute(normalizedUrlPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(normalizedUrlPath)\n\n if (matcherParams) {\n utils.normalizeDynamicRouteParams(matcherParams, false)\n Object.assign(paramsResult.params, matcherParams)\n paramsResult.hasValidParams = true\n }\n }\n\n // if an action request is bypassing a prerender and we\n // don't have the params in the URL since it was prerendered\n // and matched during handle: 'filesystem' rather than dynamic route\n // resolving we need to parse the params from the matched-path.\n // Note: this is similar to above case but from match-path instead\n // of from the request URL since a rewrite could cause that to not\n // match the src pathname\n if (\n // we can have a collision with /index and a top-level /[slug]\n matchedPath !== '/index' &&\n !paramsResult.hasValidParams &&\n !isDynamicRoute(matchedPath)\n ) {\n let matcherParams = utils.dynamicRouteMatcher?.(matchedPath)\n\n if (matcherParams) {\n const curParamsResult = utils.normalizeDynamicRouteParams(\n matcherParams,\n false\n )\n\n if (curParamsResult.hasValidParams) {\n Object.assign(params, matcherParams)\n paramsResult = curParamsResult\n }\n }\n }\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n\n const routeMatchesHeader = req.headers['x-now-route-matches']\n if (\n typeof routeMatchesHeader === 'string' &&\n routeMatchesHeader &&\n isDynamicRoute(matchedPath) &&\n !paramsResult.hasValidParams\n ) {\n const routeMatches =\n utils.getParamsFromRouteMatches(routeMatchesHeader)\n\n if (routeMatches) {\n paramsResult = utils.normalizeDynamicRouteParams(\n routeMatches,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n }\n\n // Try to parse the params from the query if we couldn't parse them\n // from the route matches but ignore missing optional params.\n if (!paramsResult.hasValidParams) {\n paramsResult = utils.normalizeDynamicRouteParams(\n queryParams,\n true\n )\n\n if (paramsResult.hasValidParams) {\n params = paramsResult.params\n }\n }\n\n // handle the actual dynamic route name being requested\n if (\n utils.defaultRouteMatches &&\n normalizedUrlPath === srcPathname &&\n !paramsResult.hasValidParams &&\n !utils.normalizeDynamicRouteParams({ ...params }, true)\n .hasValidParams\n ) {\n params = utils.defaultRouteMatches\n\n // Mark that the default route matches were set on the request\n // during routing.\n addRequestMeta(req, 'didSetDefaultRouteMatches', true)\n }\n\n if (params) {\n matchedPath = utils.interpolateDynamicPath(srcPathname, params)\n req.url = utils.interpolateDynamicPath(req.url!, params)\n\n // If the request is for a segment prefetch, we need to update the\n // segment prefetch request path to include the interpolated\n // params.\n let segmentPrefetchRSCRequest = getRequestMeta(\n req,\n 'segmentPrefetchRSCRequest'\n )\n if (\n segmentPrefetchRSCRequest &&\n isDynamicRoute(segmentPrefetchRSCRequest, false)\n ) {\n segmentPrefetchRSCRequest = utils.interpolateDynamicPath(\n segmentPrefetchRSCRequest,\n params\n )\n\n req.headers[NEXT_ROUTER_SEGMENT_PREFETCH_HEADER.toLowerCase()] =\n segmentPrefetchRSCRequest\n addRequestMeta(\n req,\n 'segmentPrefetchRSCRequest',\n segmentPrefetchRSCRequest\n )\n }\n }\n }\n\n if (pageIsDynamic || didRewrite) {\n utils.normalizeCdnUrl(req, [\n ...rewriteParamKeys,\n ...Object.keys(utils.defaultRouteRegex?.groups || {}),\n ])\n }\n // Remove the route `params` keys from `parsedUrl.query` if they are\n // not in the original query params.\n // If it's used in both route `params` and query `searchParams`, it should be kept.\n for (const key of routeParamKeys) {\n if (!(key in originQueryParams)) {\n delete parsedUrl.query[key]\n }\n }\n parsedUrl.pathname = matchedPath\n url.pathname = parsedUrl.pathname\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n } catch (err) {\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n throw err\n }\n }\n\n addRequestMeta(req, 'isLocaleDomain', Boolean(domainLocale))\n\n if (pathnameInfo.locale) {\n req.url = formatUrl(url)\n addRequestMeta(req, 'didStripLocale', true)\n }\n\n // If we aren't in minimal mode or there is no locale in the query\n // string, add the locale to the query string.\n if (!this.minimalMode || !getRequestMeta(req, 'locale')) {\n // If the locale is in the pathname, add it to the query string.\n if (pathnameInfo.locale) {\n addRequestMeta(req, 'locale', pathnameInfo.locale)\n }\n // If the default locale is available, add it to the query string and\n // mark it as inferred rather than implicit.\n else if (defaultLocale) {\n addRequestMeta(req, 'locale', defaultLocale)\n addRequestMeta(req, 'localeInferredFromDefault', true)\n }\n }\n\n // set incremental cache to request meta so it can\n // be passed down for edge functions and the fetch disk\n // cache can be leveraged locally\n if (\n !(this.serverOptions as any).webServerConfig &&\n !getRequestMeta(req, 'incrementalCache')\n ) {\n let protocol: 'http:' | 'https:' = 'https:'\n\n try {\n const parsedFullUrl = new URL(\n getRequestMeta(req, 'initURL') || '/',\n 'http://n'\n )\n protocol = parsedFullUrl.protocol as 'https:' | 'http:'\n } catch {}\n\n const incrementalCache = await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n requestProtocol: protocol.substring(0, protocol.length - 1) as\n | 'http'\n | 'https',\n })\n\n incrementalCache.resetRequestCache()\n addRequestMeta(req, 'incrementalCache', incrementalCache)\n ;(globalThis as any).__incrementalCache = incrementalCache\n }\n\n const cacheHandlers = getCacheHandlers()\n\n if (cacheHandlers) {\n await Promise.all(\n [...cacheHandlers].map(async (cacheHandler) => {\n if ('refreshTags' in cacheHandler) {\n // Note: cacheHandler.refreshTags() is called lazily before the\n // first cache entry is retrieved. It allows us to skip the\n // refresh request if no caches are read at all.\n } else {\n const previouslyRevalidatedTags = getPreviouslyRevalidatedTags(\n req.headers,\n this.getPrerenderManifest().preview.previewModeId\n )\n\n await cacheHandler.receiveExpiredTags(\n ...previouslyRevalidatedTags\n )\n }\n })\n )\n }\n\n // set server components HMR cache to request meta so it can be passed\n // down for edge functions\n if (!getRequestMeta(req, 'serverComponentsHmrCache')) {\n addRequestMeta(\n req,\n 'serverComponentsHmrCache',\n this.getServerComponentsHmrCache()\n )\n }\n\n // when invokePath is specified we can short short circuit resolving\n // we only honor this header if we are inside of a render worker to\n // prevent external users coercing the routing path\n const invokePath = getRequestMeta(req, 'invokePath')\n const useInvokePath =\n !useMatchedPathHeader &&\n process.env.NEXT_RUNTIME !== 'edge' &&\n invokePath\n\n if (useInvokePath) {\n const invokeStatus = getRequestMeta(req, 'invokeStatus')\n if (invokeStatus) {\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n res.statusCode = invokeStatus\n let err: Error | null = getRequestMeta(req, 'invokeError') || null\n\n return this.renderError(err, req, res, '/_error', parsedUrl.query)\n }\n\n const parsedMatchedPath = new URL(invokePath || '/', 'http://n')\n const invokePathnameInfo = getNextPathnameInfo(\n parsedMatchedPath.pathname,\n {\n nextConfig: this.nextConfig,\n parseData: false,\n }\n )\n\n if (invokePathnameInfo.locale) {\n addRequestMeta(req, 'locale', invokePathnameInfo.locale)\n }\n\n if (parsedUrl.pathname !== parsedMatchedPath.pathname) {\n parsedUrl.pathname = parsedMatchedPath.pathname\n addRequestMeta(req, 'rewroteURL', invokePathnameInfo.pathname)\n }\n const normalizeResult = normalizeLocalePath(\n removePathPrefix(parsedUrl.pathname, this.nextConfig.basePath || ''),\n this.nextConfig.i18n?.locales\n )\n\n if (normalizeResult.detectedLocale) {\n addRequestMeta(req, 'locale', normalizeResult.detectedLocale)\n }\n parsedUrl.pathname = normalizeResult.pathname\n\n for (const key of Object.keys(parsedUrl.query)) {\n delete parsedUrl.query[key]\n }\n const invokeQuery = getRequestMeta(req, 'invokeQuery')\n\n if (invokeQuery) {\n Object.assign(parsedUrl.query, invokeQuery)\n }\n\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n return\n }\n\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n getRequestMeta(req, 'middlewareInvoke')\n ) {\n finished = await this.normalizeAndAttachMetadata(req, res, parsedUrl)\n if (finished) return\n\n finished = await this.handleCatchallMiddlewareRequest(\n req,\n res,\n parsedUrl\n )\n if (finished) return\n\n const err = new Error()\n ;(err as any).result = {\n response: new Response(null, {\n headers: {\n 'x-middleware-next': '1',\n },\n }),\n }\n ;(err as any).bubble = true\n throw err\n }\n\n // This wasn't a request via the matched path or the invoke path, so\n // prepare for a legacy run by removing the base path.\n\n // ensure we strip the basePath when not using an invoke header\n if (!useMatchedPathHeader && pathnameInfo.basePath) {\n parsedUrl.pathname = removePathPrefix(\n parsedUrl.pathname,\n pathnameInfo.basePath\n )\n }\n\n res.statusCode = 200\n return await this.run(req, res, parsedUrl)\n } catch (err: any) {\n if (err instanceof NoFallbackError) {\n throw err\n }\n\n if (\n (err && typeof err === 'object' && err.code === 'ERR_INVALID_URL') ||\n err instanceof DecodeError ||\n err instanceof NormalizeError\n ) {\n res.statusCode = 400\n return this.renderError(null, req, res, '/_error', {})\n }\n\n if (\n this.minimalMode ||\n this.renderOpts.dev ||\n (isBubbledError(err) && err.bubble)\n ) {\n throw err\n }\n this.logError(getProperError(err))\n res.statusCode = 500\n res.body('Internal Server Error').send()\n }\n }\n\n /**\n * Normalizes a pathname without attaching any metadata from any matched\n * normalizer.\n *\n * @param pathname the pathname to normalize\n * @returns the normalized pathname\n */\n private normalize = (pathname: string) => {\n const normalizers: Array<PathnameNormalizer> = []\n\n if (this.normalizers.data) {\n normalizers.push(this.normalizers.data)\n }\n\n // We have to put the segment prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.segmentPrefetchRSC) {\n normalizers.push(this.normalizers.segmentPrefetchRSC)\n }\n\n // We have to put the prefetch normalizer before the RSC normalizer\n // because the RSC normalizer will match the prefetch RSC routes too.\n if (this.normalizers.prefetchRSC) {\n normalizers.push(this.normalizers.prefetchRSC)\n }\n\n if (this.normalizers.rsc) {\n normalizers.push(this.normalizers.rsc)\n }\n\n for (const normalizer of normalizers) {\n if (!normalizer.match(pathname)) continue\n\n return normalizer.normalize(pathname, true)\n }\n\n return pathname\n }\n\n private normalizeAndAttachMetadata: RouteHandler<\n ServerRequest,\n ServerResponse\n > = async (req, res, url) => {\n let finished = await this.handleNextImageRequest(req, res, url)\n if (finished) return true\n\n if (this.enabledDirectories.pages) {\n finished = await this.handleNextDataRequest(req, res, url)\n if (finished) return true\n }\n\n return false\n }\n\n /**\n * @internal - this method is internal to Next.js and should not be used directly by end-users\n */\n public getRequestHandlerWithMetadata(\n meta: RequestMeta\n ): BaseRequestHandler<ServerRequest, ServerResponse> {\n const handler = this.getRequestHandler()\n return (req, res, parsedUrl) => {\n setRequestMeta(req, meta)\n return handler(req, res, parsedUrl)\n }\n }\n\n public getRequestHandler(): BaseRequestHandler<\n ServerRequest,\n ServerResponse\n > {\n return this.handleRequest.bind(this)\n }\n\n protected abstract handleUpgrade(\n req: ServerRequest,\n socket: any,\n head?: any\n ): Promise<void>\n\n public setAssetPrefix(prefix?: string): void {\n this.renderOpts.assetPrefix = prefix ? prefix.replace(/\\/$/, '') : ''\n }\n\n protected prepared: boolean = false\n protected preparedPromise: Promise<void> | null = null\n /**\n * Runs async initialization of server.\n * It is idempotent, won't fire underlying initialization more than once.\n */\n public async prepare(): Promise<void> {\n if (this.prepared) return\n\n // Get instrumentation module\n if (!this.instrumentation) {\n this.instrumentation = await this.loadInstrumentationModule()\n }\n if (this.preparedPromise === null) {\n this.preparedPromise = this.prepareImpl().then(() => {\n this.prepared = true\n this.preparedPromise = null\n })\n }\n return this.preparedPromise\n }\n protected async prepareImpl(): Promise<void> {}\n protected async loadInstrumentationModule(): Promise<any> {}\n\n public async close(): Promise<void> {}\n\n protected getAppPathRoutes(): Record<string, string[]> {\n const appPathRoutes: Record<string, string[]> = {}\n\n Object.keys(this.appPathsManifest || {}).forEach((entry) => {\n const normalizedPath = normalizeAppPath(entry)\n if (!appPathRoutes[normalizedPath]) {\n appPathRoutes[normalizedPath] = []\n }\n appPathRoutes[normalizedPath].push(entry)\n })\n return appPathRoutes\n }\n\n protected async run(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.run, async () =>\n this.runImpl(req, res, parsedUrl)\n )\n }\n\n private async runImpl(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl: UrlWithParsedQuery\n ): Promise<void> {\n await this.handleCatchallRenderRequest(req, res, parsedUrl)\n }\n\n private async pipe(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.pipe, async () =>\n this.pipeImpl(fn, partialContext)\n )\n }\n\n private async pipeImpl(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<void> {\n const ua = partialContext.req.headers['user-agent'] || ''\n\n const ctx: RequestContext<ServerRequest, ServerResponse> = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n // `renderOpts.botType` is accumulated in `this.renderImpl()`\n supportsDynamicResponse: !this.renderOpts.botType,\n serveStreamingMetadata: shouldServeStreamingMetadata(\n ua,\n this.nextConfig.htmlLimitedBots\n ),\n },\n }\n\n const payload = await fn(ctx)\n if (payload === null) {\n return\n }\n const { req, res } = ctx\n const originalStatus = res.statusCode\n const { body, type } = payload\n let { cacheControl } = payload\n if (!res.sent) {\n const { generateEtags, poweredByHeader, dev } = this.renderOpts\n\n // In dev, we should not cache pages for any reason.\n if (dev) {\n res.setHeader('Cache-Control', 'no-store, must-revalidate')\n cacheControl = undefined\n }\n\n if (cacheControl && cacheControl.expire === undefined) {\n cacheControl.expire = this.nextConfig.expireTime\n }\n\n await this.sendRenderResult(req, res, {\n result: body,\n type,\n generateEtags,\n poweredByHeader,\n cacheControl,\n })\n res.statusCode = originalStatus\n }\n }\n\n private async getStaticHTML(\n fn: (\n ctx: RequestContext<ServerRequest, ServerResponse>\n ) => Promise<ResponsePayload | null>,\n partialContext: Omit<\n RequestContext<ServerRequest, ServerResponse>,\n 'renderOpts'\n >\n ): Promise<string | null> {\n const ctx: RequestContext<ServerRequest, ServerResponse> = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n supportsDynamicResponse: false,\n },\n }\n const payload = await fn(ctx)\n if (payload === null) {\n return null\n }\n return payload.body.toUnchunkedString()\n }\n\n public async render(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.render, async () =>\n this.renderImpl(req, res, pathname, query, parsedUrl, internalRender)\n )\n }\n\n protected getWaitUntil(): WaitUntil | undefined {\n const builtinRequestContext = getBuiltinRequestContext()\n if (builtinRequestContext) {\n // the platform provided a request context.\n // use the `waitUntil` from there, whether actually present or not --\n // if not present, `after` will error.\n\n // NOTE: if we're in an edge runtime sandbox, this context will be used to forward the outer waitUntil.\n return builtinRequestContext.waitUntil\n }\n\n if (this.minimalMode) {\n // we're built for a serverless environment, and `waitUntil` is not available,\n // but using a noop would likely lead to incorrect behavior,\n // because we have no way of keeping the invocation alive.\n // return nothing, and `after` will error if used.\n //\n // NOTE: for edge functions, `NextWebServer` always runs in minimal mode.\n //\n // NOTE: if we're in an edge runtime sandbox, waitUntil will be passed in using \"@next/request-context\",\n // so we won't get here.\n return undefined\n }\n\n return this.getInternalWaitUntil()\n }\n\n protected getInternalWaitUntil(): WaitUntil | undefined {\n return undefined\n }\n\n private async renderImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n parsedUrl?: NextUrlWithParsedQuery,\n internalRender = false\n ): Promise<void> {\n if (!pathname.startsWith('/')) {\n console.warn(\n `Cannot render page with path \"${pathname}\", did you mean \"/${pathname}\"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`\n )\n }\n\n if (\n this.serverOptions.customServer &&\n pathname === '/index' &&\n !(await this.hasPage('/index'))\n ) {\n // maintain backwards compatibility for custom server\n // (see custom-server integration tests)\n pathname = '/'\n }\n\n const ua = req.headers['user-agent'] || ''\n this.renderOpts.botType = getBotType(ua)\n\n // we allow custom servers to call render for all URLs\n // so check if we need to serve a static _next file or not.\n // we don't modify the URL for _next/data request but still\n // call render so we special case this to prevent an infinite loop\n if (\n !internalRender &&\n !this.minimalMode &&\n !getRequestMeta(req, 'isNextDataReq') &&\n (req.url?.match(/^\\/_next\\//) ||\n (this.hasStaticDir && req.url!.match(/^\\/static\\//)))\n ) {\n return this.handleRequest(req, res, parsedUrl)\n }\n\n if (isBlockedPage(pathname)) {\n return this.render404(req, res, parsedUrl)\n }\n\n return this.pipe((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n protected async getStaticPaths({\n pathname,\n }: {\n pathname: string\n requestHeaders: import('./lib/incremental-cache').IncrementalCache['requestHeaders']\n page: string\n isAppPath: boolean\n }): Promise<{\n staticPaths?: string[]\n fallbackMode?: FallbackMode\n }> {\n // Read whether or not fallback should exist from the manifest.\n const fallbackField =\n this.getPrerenderManifest().dynamicRoutes[pathname]?.fallback\n\n return {\n // `staticPaths` is intentionally set to `undefined` as it should've\n // been caught when checking disk data.\n staticPaths: undefined,\n fallbackMode: parseFallbackField(fallbackField),\n }\n }\n\n private async renderToResponseWithComponents(\n requestContext: RequestContext<ServerRequest, ServerResponse>,\n findComponentsResult: FindComponentsResult\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(\n BaseServerSpan.renderToResponseWithComponents,\n async () =>\n this.renderToResponseWithComponentsImpl(\n requestContext,\n findComponentsResult\n )\n )\n }\n\n protected pathCouldBeIntercepted(resolvedPathname: string): boolean {\n return (\n isInterceptionRouteAppPath(resolvedPathname) ||\n this.interceptionRoutePatterns.some((regexp) => {\n return regexp.test(resolvedPathname)\n })\n )\n }\n\n protected setVaryHeader(\n req: ServerRequest,\n res: ServerResponse,\n isAppPath: boolean,\n resolvedPathname: string\n ): void {\n let addedNextUrlToVary = false\n\n if (isAppPath && this.pathCouldBeIntercepted(resolvedPathname)) {\n // Interception route responses can vary based on the `Next-URL` header.\n // We use the Vary header to signal this behavior to the client to properly cache the response.\n res.appendHeader('vary', `${NEXT_URL}`)\n addedNextUrlToVary = true\n }\n // For other cases such as App Router requests or RSC requests we don't need to set vary header since we already\n // have the _rsc query with the unique hash value.\n\n if (!addedNextUrlToVary) {\n // Remove `Next-URL` from the request headers we determined it wasn't necessary to include in the Vary header.\n // This is to avoid any dependency on the `Next-URL` header being present when preparing the response.\n delete req.headers[NEXT_URL]\n }\n }\n\n private async renderToResponseWithComponentsImpl(\n {\n req,\n res,\n pathname,\n renderOpts: opts,\n }: RequestContext<ServerRequest, ServerResponse>,\n { components, query }: FindComponentsResult\n ): Promise<ResponsePayload | null> {\n if (pathname === UNDERSCORE_NOT_FOUND_ROUTE) {\n pathname = '/404'\n }\n const isErrorPathname = pathname === '/_error'\n const is404Page =\n pathname === '/404' || (isErrorPathname && res.statusCode === 404)\n const is500Page =\n pathname === '/500' || (isErrorPathname && res.statusCode === 500)\n const isAppPath = components.isAppPath === true\n\n const hasServerProps = !!components.getServerSideProps\n let hasGetStaticPaths = !!components.getStaticPaths\n const isPossibleServerAction = getIsPossibleServerAction(req)\n const hasGetInitialProps = !!components.Component?.getInitialProps\n let isSSG = !!components.getStaticProps\n\n // Compute the iSSG cache key. We use the rewroteUrl since\n // pages with fallback: false are allowed to be rewritten to\n // and we need to look up the path by the rewritten path\n let urlPathname = parseUrl(req.url || '').pathname || '/'\n\n let resolvedUrlPathname = getRequestMeta(req, 'rewroteURL') || urlPathname\n\n this.setVaryHeader(req, res, isAppPath, resolvedUrlPathname)\n\n let staticPaths: string[] | undefined\n let fallbackMode: FallbackMode | undefined\n let hasFallback = false\n\n const isDynamic = isDynamicRoute(components.page)\n\n const prerenderManifest = this.getPrerenderManifest()\n\n if (isAppPath && isDynamic) {\n const pathsResult = await this.getStaticPaths({\n pathname,\n page: components.page,\n isAppPath,\n requestHeaders: req.headers,\n })\n\n staticPaths = pathsResult.staticPaths\n fallbackMode = pathsResult.fallbackMode\n hasFallback = typeof fallbackMode !== 'undefined'\n\n if (this.nextConfig.output === 'export') {\n const page = components.page\n if (!staticPaths) {\n throw new Error(\n `Page \"${page}\" is missing exported function \"generateStaticParams()\", which is required with \"output: export\" config.`\n )\n }\n\n const resolvedWithoutSlash = removeTrailingSlash(resolvedUrlPathname)\n if (!staticPaths.includes(resolvedWithoutSlash)) {\n throw new Error(\n `Page \"${page}\" is missing param \"${resolvedWithoutSlash}\" in \"generateStaticParams()\", which is required with \"output: export\" config.`\n )\n }\n }\n\n if (hasFallback) {\n hasGetStaticPaths = true\n }\n }\n\n if (\n hasFallback ||\n staticPaths?.includes(resolvedUrlPathname) ||\n // this signals revalidation in deploy environments\n // TODO: make this more generic\n req.headers['x-now-route-matches']\n ) {\n isSSG = true\n } else if (!this.renderOpts.dev) {\n isSSG ||= !!prerenderManifest.routes[toRoute(pathname)]\n }\n\n // Toggle whether or not this is a Data request\n const isNextDataRequest =\n !!(\n getRequestMeta(req, 'isNextDataReq') ||\n (req.headers['x-nextjs-data'] &&\n (this.serverOptions as any).webServerConfig)\n ) &&\n (isSSG || hasServerProps)\n\n /**\n * If true, this indicates that the request being made is for an app\n * prefetch request.\n */\n const isPrefetchRSCRequest =\n getRequestMeta(req, 'isPrefetchRSCRequest') ?? false\n\n // NOTE: Don't delete headers[RSC] yet, it still needs to be used in renderToHTML later\n\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n\n // when we are handling a middleware prefetch and it doesn't\n // resolve to a static data route we bail early to avoid\n // unexpected SSR invocations\n if (\n !isSSG &&\n req.headers['x-middleware-prefetch'] &&\n !(is404Page || pathname === '/_error')\n ) {\n res.setHeader(MATCHED_PATH_HEADER, pathname)\n res.setHeader('x-middleware-skip', '1')\n res.setHeader(\n 'cache-control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n res.body('{}').send()\n return null\n }\n\n // normalize req.url for SSG paths as it is not exposed\n // to getStaticProps and the asPath should not expose /_next/data\n if (\n isSSG &&\n this.minimalMode &&\n req.headers[MATCHED_PATH_HEADER] &&\n req.url.startsWith('/_next/data')\n ) {\n req.url = this.stripNextDataPath(req.url)\n }\n\n const locale = getRequestMeta(req, 'locale')\n const defaultLocale = isSSG\n ? this.nextConfig.i18n?.defaultLocale\n : getRequestMeta(req, 'defaultLocale')\n\n if (\n !!req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200)\n ) {\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n }\n\n let routeModule: RouteModule | undefined\n if (components.routeModule) {\n routeModule = components.routeModule\n }\n\n /**\n * If the route being rendered is an app page, and the ppr feature has been\n * enabled, then the given route _could_ support PPR.\n */\n const couldSupportPPR: boolean =\n this.isAppPPREnabled &&\n typeof routeModule !== 'undefined' &&\n isAppPageRouteModule(routeModule)\n\n // When enabled, this will allow the use of the `?__nextppronly` query to\n // enable debugging of the static shell.\n const hasDebugStaticShellQuery =\n process.env.__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING === '1' &&\n typeof query.__nextppronly !== 'undefined' &&\n couldSupportPPR\n\n // When enabled, this will allow the use of the `?__nextppronly` query\n // to enable debugging of the fallback shell.\n const hasDebugFallbackShellQuery =\n hasDebugStaticShellQuery && query.__nextppronly === 'fallback'\n\n // This page supports PPR if it is marked as being `PARTIALLY_STATIC` in the\n // prerender manifest and this is an app page.\n const isRoutePPREnabled: boolean =\n couldSupportPPR &&\n ((\n prerenderManifest.routes[pathname] ??\n prerenderManifest.dynamicRoutes[pathname]\n )?.renderingMode === 'PARTIALLY_STATIC' ||\n // Ideally we'd want to check the appConfig to see if this page has PPR\n // enabled or not, but that would require plumbing the appConfig through\n // to the server during development. We assume that the page supports it\n // but only during development.\n (hasDebugStaticShellQuery &&\n (this.renderOpts.dev === true ||\n this.experimentalTestProxy === true)))\n\n const isDebugStaticShell: boolean =\n hasDebugStaticShellQuery && isRoutePPREnabled\n\n // We should enable debugging dynamic accesses when the static shell\n // debugging has been enabled and we're also in development mode.\n const isDebugDynamicAccesses =\n isDebugStaticShell && this.renderOpts.dev === true\n\n const isDebugFallbackShell = hasDebugFallbackShellQuery && isRoutePPREnabled\n\n // If we're in minimal mode, then try to get the postponed information from\n // the request metadata. If available, use it for resuming the postponed\n // render.\n const minimalPostponed = isRoutePPREnabled\n ? getRequestMeta(req, 'postponed')\n : undefined\n\n // If PPR is enabled, and this is a RSC request (but not a prefetch), then\n // we can use this fact to only generate the flight data for the request\n // because we can't cache the HTML (as it's also dynamic).\n const isDynamicRSCRequest =\n isRoutePPREnabled && isRSCRequest && !isPrefetchRSCRequest\n\n // Need to read this before it's stripped by stripFlightHeaders. We don't\n // need to transfer it to the request meta because it's only read\n // within this function; the static segment data should have already been\n // generated, so we will always either return a static response or a 404.\n const segmentPrefetchHeader = getRequestMeta(\n req,\n 'segmentPrefetchRSCRequest'\n )\n\n const isHtmlBot = isHtmlBotRequest(req)\n if (isHtmlBot && isRoutePPREnabled) {\n isSSG = false\n this.renderOpts.serveStreamingMetadata = false\n }\n\n // we need to ensure the status code if /404 is visited directly\n if (is404Page && !isNextDataRequest && !isRSCRequest) {\n res.statusCode = 404\n }\n\n // ensure correct status is set when visiting a status page\n // directly e.g. /500\n if (STATIC_STATUS_PAGES.includes(pathname)) {\n res.statusCode = parseInt(pathname.slice(1), 10)\n }\n\n if (\n // Server actions can use non-GET/HEAD methods.\n !isPossibleServerAction &&\n // Resume can use non-GET/HEAD methods.\n !minimalPostponed &&\n !is404Page &&\n !is500Page &&\n pathname !== '/_error' &&\n req.method !== 'HEAD' &&\n req.method !== 'GET' &&\n (typeof components.Component === 'string' || isSSG)\n ) {\n res.statusCode = 405\n res.setHeader('Allow', ['GET', 'HEAD'])\n res.body('Method Not Allowed').send()\n return null\n }\n\n // handle static page\n if (typeof components.Component === 'string') {\n return {\n type: 'html',\n // TODO: Static pages should be serialized as RenderResult\n body: RenderResult.fromStatic(components.Component),\n }\n }\n\n // Ensure that if the `amp` query parameter is falsy that we remove it from\n // the query object. This ensures it won't be found by the `in` operator.\n if ('amp' in query && !query.amp) delete query.amp\n\n if (opts.supportsDynamicResponse === true) {\n const ua = req.headers['user-agent'] || ''\n const isBotRequest = isBot(ua)\n const isSupportedDocument =\n typeof components.Document?.getInitialProps !== 'function' ||\n // The built-in `Document` component also supports dynamic HTML for concurrent mode.\n NEXT_BUILTIN_DOCUMENT in components.Document\n\n // Disable dynamic HTML in cases that we know it won't be generated,\n // so that we can continue generating a cache key when possible.\n // TODO-APP: should the first render for a dynamic app path\n // be static so we can collect revalidate and populate the\n // cache if there are no dynamic data requirements\n opts.supportsDynamicResponse =\n !isSSG && !isBotRequest && !query.amp && isSupportedDocument\n }\n\n // In development, we always want to generate dynamic HTML.\n if (!isNextDataRequest && isAppPath && opts.dev) {\n opts.supportsDynamicResponse = true\n }\n\n const locales = this.nextConfig.i18n?.locales\n\n let previewData: PreviewData\n let isPreviewMode = false\n\n if (hasServerProps || isSSG || isAppPath) {\n // For the edge runtime, we don't support preview mode in SSG.\n if (process.env.NEXT_RUNTIME !== 'edge') {\n const { tryGetPreviewData } =\n require('./api-utils/node/try-get-preview-data') as typeof import('./api-utils/node/try-get-preview-data')\n previewData = tryGetPreviewData(\n req,\n res,\n this.renderOpts.previewProps,\n !!this.nextConfig.experimental.multiZoneDraftMode\n )\n isPreviewMode = previewData !== false\n }\n }\n\n // If this is a request for an app path that should be statically generated\n // and we aren't in the edge runtime, strip the flight headers so it will\n // generate the static response.\n if (\n isAppPath &&\n !opts.dev &&\n !isPreviewMode &&\n isSSG &&\n isRSCRequest &&\n !isDynamicRSCRequest &&\n (!isEdgeRuntime(opts.runtime) ||\n (this.serverOptions as any).webServerConfig)\n ) {\n stripFlightHeaders(req.headers)\n }\n\n let { isOnDemandRevalidate, revalidateOnlyGenerated } =\n checkIsOnDemandRevalidate(req, this.renderOpts.previewProps)\n\n if (isSSG && this.minimalMode && req.headers[MATCHED_PATH_HEADER]) {\n // the url value is already correct when the matched-path header is set\n resolvedUrlPathname = urlPathname\n }\n\n urlPathname = removeTrailingSlash(urlPathname)\n resolvedUrlPathname = removeTrailingSlash(resolvedUrlPathname)\n if (this.localeNormalizer) {\n resolvedUrlPathname = this.localeNormalizer.normalize(resolvedUrlPathname)\n }\n\n const handleRedirect = (pageData: any) => {\n const redirect = {\n destination: pageData.pageProps.__N_REDIRECT,\n statusCode: pageData.pageProps.__N_REDIRECT_STATUS,\n basePath: pageData.pageProps.__N_REDIRECT_BASE_PATH,\n }\n const statusCode = getRedirectStatus(redirect)\n const { basePath } = this.nextConfig\n\n if (\n basePath &&\n redirect.basePath !== false &&\n redirect.destination.startsWith('/')\n ) {\n redirect.destination = `${basePath}${redirect.destination}`\n }\n\n if (redirect.destination.startsWith('/')) {\n redirect.destination = normalizeRepeatedSlashes(redirect.destination)\n }\n\n res\n .redirect(redirect.destination, statusCode)\n .body(redirect.destination)\n .send()\n }\n\n // remove /_next/data prefix from urlPathname so it matches\n // for direct page visit and /_next/data visit\n if (isNextDataRequest) {\n resolvedUrlPathname = this.stripNextDataPath(resolvedUrlPathname)\n urlPathname = this.stripNextDataPath(urlPathname)\n }\n\n let ssgCacheKey: string | null = null\n if (\n !isPreviewMode &&\n isSSG &&\n !opts.supportsDynamicResponse &&\n !isPossibleServerAction &&\n !minimalPostponed &&\n !isDynamicRSCRequest\n ) {\n ssgCacheKey = `${locale ? `/${locale}` : ''}${\n (pathname === '/' || resolvedUrlPathname === '/') && locale\n ? ''\n : resolvedUrlPathname\n }${query.amp ? '.amp' : ''}`\n }\n\n if ((is404Page || is500Page) && isSSG) {\n ssgCacheKey = `${locale ? `/${locale}` : ''}${pathname}${\n query.amp ? '.amp' : ''\n }`\n }\n\n if (ssgCacheKey) {\n ssgCacheKey = decodePathParams(ssgCacheKey)\n\n // ensure /index and / is normalized to one key\n ssgCacheKey =\n ssgCacheKey === '/index' && pathname === '/' ? '/' : ssgCacheKey\n }\n let protocol: 'http:' | 'https:' = 'https:'\n\n try {\n const parsedFullUrl = new URL(\n getRequestMeta(req, 'initURL') || '/',\n 'http://n'\n )\n protocol = parsedFullUrl.protocol as 'https:' | 'http:'\n } catch {}\n\n // use existing incrementalCache instance if available\n const incrementalCache: import('./lib/incremental-cache').IncrementalCache =\n (globalThis as any).__incrementalCache ||\n (await this.getIncrementalCache({\n requestHeaders: Object.assign({}, req.headers),\n requestProtocol: protocol.substring(0, protocol.length - 1) as\n | 'http'\n | 'https',\n }))\n\n // TODO: investigate, this is not safe across multiple concurrent requests\n incrementalCache.resetRequestCache()\n\n type RendererContext = {\n /**\n * The postponed data for this render. This is only provided when resuming\n * a render that has been postponed.\n */\n postponed: string | undefined\n\n pagesFallback: boolean | undefined\n\n /**\n * The unknown route params for this render.\n */\n fallbackRouteParams: FallbackRouteParams | null\n }\n type Renderer = (\n context: RendererContext\n ) => Promise<ResponseCacheEntry | null>\n\n const doRender: Renderer = async ({\n postponed,\n pagesFallback = false,\n fallbackRouteParams,\n }) => {\n // In development, we always want to generate dynamic HTML.\n let supportsDynamicResponse: boolean =\n // If we're in development, we always support dynamic HTML, unless it's\n // a data request, in which case we only produce static HTML.\n (!isNextDataRequest && opts.dev === true) ||\n // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n (!isSSG && !hasGetStaticPaths) ||\n // If this request has provided postponed data, it supports dynamic\n // HTML.\n typeof postponed === 'string' ||\n // If this is a dynamic RSC request, then this render supports dynamic\n // HTML (it's dynamic).\n isDynamicRSCRequest\n\n const origQuery = parseUrl(req.url || '', true).query\n\n // clear any dynamic route params so they aren't in\n // the resolvedUrl\n if (opts.params) {\n Object.keys(opts.params).forEach((key) => {\n delete origQuery[key]\n })\n }\n const hadTrailingSlash =\n urlPathname !== '/' && this.nextConfig.trailingSlash\n\n const resolvedUrl = formatUrl({\n pathname: `${resolvedUrlPathname}${hadTrailingSlash ? '/' : ''}`,\n // make sure to only add query values from original URL\n query: origQuery,\n })\n\n // When html bots request PPR page, perform the full dynamic rendering.\n const shouldWaitOnAllReady = isHtmlBot && isRoutePPREnabled\n\n const renderOpts: LoadedRenderOpts = {\n ...components,\n ...opts,\n ...(isAppPath\n ? {\n incrementalCache,\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n isRevalidate: isSSG && !postponed && !isDynamicRSCRequest,\n serverActions: this.nextConfig.experimental.serverActions,\n }\n : {}),\n isNextDataRequest,\n resolvedUrl,\n locale,\n locales,\n defaultLocale,\n multiZoneDraftMode: this.nextConfig.experimental.multiZoneDraftMode,\n // For getServerSideProps and getInitialProps we need to ensure we use the original URL\n // and not the resolved URL to prevent a hydration mismatch on\n // asPath\n resolvedAsPath:\n hasServerProps || hasGetInitialProps\n ? formatUrl({\n // we use the original URL pathname less the _next/data prefix if\n // present\n pathname: `${urlPathname}${hadTrailingSlash ? '/' : ''}`,\n query: origQuery,\n })\n : resolvedUrl,\n experimental: {\n ...opts.experimental,\n isRoutePPREnabled,\n },\n supportsDynamicResponse,\n shouldWaitOnAllReady,\n isOnDemandRevalidate,\n isDraftMode: isPreviewMode,\n isPossibleServerAction,\n postponed,\n waitUntil: this.getWaitUntil(),\n onClose: res.onClose.bind(res),\n onAfterTaskError: undefined,\n // only available in dev\n setIsrStatus: (this as any).setIsrStatus,\n }\n\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n supportsDynamicResponse = false\n renderOpts.nextExport = true\n renderOpts.supportsDynamicResponse = false\n renderOpts.isStaticGeneration = true\n renderOpts.isRevalidate = true\n renderOpts.isDebugDynamicAccesses = isDebugDynamicAccesses\n }\n\n // Legacy render methods will return a render result that needs to be\n // served by the server.\n let result: RenderResult\n\n if (routeModule) {\n if (isAppRouteRouteModule(routeModule)) {\n if (\n // The type check here ensures that `req` is correctly typed, and the\n // environment variable check provides dead code elimination.\n process.env.NEXT_RUNTIME === 'edge' ||\n !isNodeNextRequest(req) ||\n !isNodeNextResponse(res)\n ) {\n throw new Error(\n 'Invariant: App Route Route Modules cannot be used in the edge runtime'\n )\n }\n\n const context: AppRouteRouteHandlerContext = {\n params: opts.params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n dynamicIO: renderOpts.experimental.dynamicIO,\n authInterrupts: renderOpts.experimental.authInterrupts,\n },\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: this.nextConfig.experimental?.cacheLife,\n isRevalidate: isSSG,\n waitUntil: this.getWaitUntil(),\n onClose: res.onClose.bind(res),\n onAfterTaskError: undefined,\n onInstrumentationRequestError:\n this.renderOpts.onInstrumentationRequestError,\n },\n sharedContext: {\n buildId: this.buildId,\n },\n }\n\n try {\n const request = NextRequestAdapter.fromNodeNextRequest(\n req,\n signalFromNodeResponse(res.originalResponse)\n )\n\n const response = await routeModule.handle(request, context)\n\n ;(req as any).fetchMetrics = (\n context.renderOpts as any\n ).fetchMetrics\n\n const cacheTags = context.renderOpts.collectedTags\n\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isSSG) {\n const blob = await response.blob()\n\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers)\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type\n }\n\n const revalidate =\n typeof context.renderOpts.collectedRevalidate === 'undefined' ||\n context.renderOpts.collectedRevalidate >= INFINITE_CACHE\n ? false\n : context.renderOpts.collectedRevalidate\n\n const expire =\n typeof context.renderOpts.collectedExpire === 'undefined' ||\n context.renderOpts.collectedExpire >= INFINITE_CACHE\n ? undefined\n : context.renderOpts.collectedExpire\n\n // Create the cache entry for the response.\n const cacheEntry: ResponseCacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers,\n },\n cacheControl: { revalidate, expire },\n isFallback: false,\n }\n\n return cacheEntry\n }\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil\n\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (context.renderOpts.waitUntil) {\n context.renderOpts.waitUntil(pendingWaitUntil)\n pendingWaitUntil = undefined\n }\n }\n\n // Send the response now that we have copied it into the cache.\n await sendResponse(\n req,\n res,\n response,\n context.renderOpts.pendingWaitUntil\n )\n return null\n } catch (err) {\n await this.instrumentationOnRequestError(err, req, {\n routerKind: 'App Router',\n routePath: pathname,\n routeType: 'route',\n revalidateReason: getRevalidateReason(renderOpts),\n })\n\n // If this is during static generation, throw the error again.\n if (isSSG) throw err\n\n Log.error(err)\n\n // Otherwise, send a 500 response.\n await sendResponse(req, res, new Response(null, { status: 500 }))\n\n return null\n }\n } else if (\n isPagesRouteModule(routeModule) ||\n isAppPageRouteModule(routeModule)\n ) {\n // An OPTIONS request to a page handler is invalid.\n if (req.method === 'OPTIONS' && !is404Page) {\n await sendResponse(req, res, new Response(null, { status: 400 }))\n return null\n }\n\n if (isPagesRouteModule(routeModule)) {\n // Due to the way we pass data by mutating `renderOpts`, we can't extend\n // the object here but only updating its `clientReferenceManifest` and\n // `nextFontManifest` properties.\n // https://github.com/vercel/next.js/blob/df7cbd904c3bd85f399d1ce90680c0ecf92d2752/packages/next/server/render.tsx#L947-L952\n renderOpts.nextFontManifest = this.nextFontManifest\n renderOpts.clientReferenceManifest =\n components.clientReferenceManifest\n\n const request = isNodeNextRequest(req) ? req.originalRequest : req\n const response = isNodeNextResponse(res)\n ? res.originalResponse\n : res\n\n // Call the built-in render method on the module.\n try {\n result = await routeModule.render(\n request as any,\n response as any,\n {\n page: pathname,\n params: opts.params,\n query,\n renderOpts,\n sharedContext: {\n buildId: this.buildId,\n deploymentId: this.nextConfig.deploymentId,\n customServer: this.serverOptions.customServer || undefined,\n },\n renderContext: {\n isFallback: pagesFallback,\n isDraftMode: renderOpts.isDraftMode,\n developmentNotFoundSourcePage: getRequestMeta(\n req,\n 'developmentNotFoundSourcePage'\n ),\n },\n }\n )\n } catch (err) {\n await this.instrumentationOnRequestError(err, req, {\n routerKind: 'Pages Router',\n routePath: pathname,\n routeType: 'render',\n revalidateReason: getRevalidateReason({\n isRevalidate: isSSG,\n isOnDemandRevalidate: renderOpts.isOnDemandRevalidate,\n }),\n })\n throw err\n }\n } else {\n const module = components.routeModule as AppPageRouteModule\n\n // Due to the way we pass data by mutating `renderOpts`, we can't extend the\n // object here but only updating its `nextFontManifest` field.\n // https://github.com/vercel/next.js/blob/df7cbd904c3bd85f399d1ce90680c0ecf92d2752/packages/next/server/render.tsx#L947-L952\n renderOpts.nextFontManifest = this.nextFontManifest\n\n const context: AppPageRouteHandlerContext = {\n page: is404Page ? '/404' : pathname,\n params: opts.params,\n query,\n fallbackRouteParams,\n renderOpts,\n serverComponentsHmrCache: this.getServerComponentsHmrCache(),\n sharedContext: {\n buildId: this.buildId,\n },\n }\n\n // TODO: adapt for putting the RDC inside the postponed data\n // If we're in dev, and this isn't a prefetch or a server action,\n // we should seed the resume data cache.\n if (\n this.nextConfig.experimental.dynamicIO &&\n this.renderOpts.dev &&\n !isPrefetchRSCRequest &&\n !isPossibleServerAction\n ) {\n const warmup = await module.warmup(req, res, context)\n\n // If the warmup is successful, we should use the resume data\n // cache from the warmup.\n if (warmup.metadata.devRenderResumeDataCache) {\n renderOpts.devRenderResumeDataCache =\n warmup.metadata.devRenderResumeDataCache\n }\n }\n\n // Call the built-in render method on the module.\n result = await module.render(req, res, context)\n }\n } else {\n throw new Error('Invariant: Unknown route module type')\n }\n } else {\n // If we didn't match a page, we should fallback to using the legacy\n // render method.\n result = await this.renderHTML(req, res, pathname, query, renderOpts)\n }\n\n const { metadata } = result\n\n const {\n cacheControl,\n headers = {},\n // Add any fetch tags that were on the page to the response headers.\n fetchTags: cacheTags,\n } = metadata\n\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags\n }\n\n // Pull any fetch metrics from the render onto the request.\n ;(req as any).fetchMetrics = metadata.fetchMetrics\n\n // we don't throw static to dynamic errors in dev as isSSG\n // is a best guess in dev since we don't have the prerender pass\n // to know whether the path is actually static or not\n if (\n isAppPath &&\n isSSG &&\n cacheControl?.revalidate === 0 &&\n !this.renderOpts.dev &&\n !isRoutePPREnabled\n ) {\n const staticBailoutInfo = metadata.staticBailoutInfo\n\n const err = new Error(\n `Page changed from static to dynamic at runtime ${urlPathname}${\n staticBailoutInfo?.description\n ? `, reason: ${staticBailoutInfo.description}`\n : ``\n }` +\n `\\nsee more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`\n )\n\n if (staticBailoutInfo?.stack) {\n const stack = staticBailoutInfo.stack\n err.stack = err.message + stack.substring(stack.indexOf('\\n'))\n }\n\n throw err\n }\n\n // Based on the metadata, we can determine what kind of cache result we\n // should return.\n\n // Handle `isNotFound`.\n if ('isNotFound' in metadata && metadata.isNotFound) {\n return {\n value: null,\n cacheControl,\n isFallback: false,\n } satisfies ResponseCacheEntry\n }\n\n // Handle `isRedirect`.\n if (metadata.isRedirect) {\n return {\n value: {\n kind: CachedRouteKind.REDIRECT,\n props: metadata.pageData ?? metadata.flightData,\n } satisfies CachedRedirectValue,\n cacheControl,\n isFallback: false,\n } satisfies ResponseCacheEntry\n }\n\n // Handle `isNull`.\n if (result.isNull) {\n return null\n }\n\n // We now have a valid HTML result that we can return to the user.\n if (isAppPath) {\n return {\n value: {\n kind: CachedRouteKind.APP_PAGE,\n html: result,\n headers,\n rscData: metadata.flightData,\n postponed: metadata.postponed,\n status: res.statusCode,\n segmentData: metadata.segmentData,\n } satisfies CachedAppPageValue,\n cacheControl,\n isFallback: !!fallbackRouteParams,\n } satisfies ResponseCacheEntry\n }\n\n return {\n value: {\n kind: CachedRouteKind.PAGES,\n html: result,\n pageData: metadata.pageData ?? metadata.flightData,\n headers,\n status: isAppPath ? res.statusCode : undefined,\n } satisfies CachedPageValue,\n cacheControl,\n isFallback: pagesFallback,\n }\n }\n\n let responseGenerator: ResponseGenerator = async ({\n hasResolved,\n previousCacheEntry,\n isRevalidating,\n }): Promise<ResponseCacheEntry | null> => {\n const isProduction = !this.renderOpts.dev\n const didRespond = hasResolved || res.sent\n\n // If we haven't found the static paths for the route, then do it now.\n if (!staticPaths && isDynamic) {\n if (hasGetStaticPaths) {\n const pathsResult = await this.getStaticPaths({\n pathname,\n requestHeaders: req.headers,\n isAppPath,\n page: components.page,\n })\n\n staticPaths = pathsResult.staticPaths\n fallbackMode = pathsResult.fallbackMode\n } else {\n staticPaths = undefined\n fallbackMode = FallbackMode.NOT_FOUND\n }\n }\n\n // When serving a bot request, we want to serve a blocking render and not\n // the prerendered page. This ensures that the correct content is served\n // to the bot in the head.\n if (\n fallbackMode === FallbackMode.PRERENDER &&\n isBot(req.headers['user-agent'] || '')\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // skip on-demand revalidate if cache is not present and\n // revalidate-if-generated is set\n if (\n isOnDemandRevalidate &&\n revalidateOnlyGenerated &&\n !previousCacheEntry &&\n !this.minimalMode\n ) {\n await this.render404(req, res)\n return null\n }\n\n if (previousCacheEntry?.isStale === -1) {\n isOnDemandRevalidate = true\n }\n\n // TODO: adapt for PPR\n // only allow on-demand revalidate for fallback: true/blocking\n // or for prerendered fallback: false paths\n if (\n isOnDemandRevalidate &&\n (fallbackMode !== FallbackMode.NOT_FOUND || previousCacheEntry)\n ) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // We use `ssgCacheKey` here as it is normalized to match the encoding\n // from getStaticPaths along with including the locale.\n //\n // We use the `resolvedUrlPathname` for the development case when this\n // is an app path since it doesn't include locale information.\n //\n // We decode the `resolvedUrlPathname` to correctly match the app path\n // with prerendered paths.\n let staticPathKey = ssgCacheKey\n if (!staticPathKey && opts.dev && isAppPath) {\n staticPathKey = decodePathParams(resolvedUrlPathname)\n }\n if (staticPathKey && query.amp) {\n staticPathKey = staticPathKey.replace(/\\.amp$/, '')\n }\n\n const isPageIncludedInStaticPaths =\n staticPathKey && staticPaths?.includes(staticPathKey)\n\n // When experimental compile is used, no pages have been prerendered,\n // so they should all be blocking.\n\n // @ts-expect-error internal field\n if (this.nextConfig.experimental.isExperimentalCompile) {\n fallbackMode = FallbackMode.BLOCKING_STATIC_RENDER\n }\n\n // When we did not respond from cache, we need to choose to block on\n // rendering or return a skeleton.\n //\n // - Data requests always block.\n // - Blocking mode fallback always blocks.\n // - Preview mode toggles all pages to be resolved in a blocking manner.\n // - Non-dynamic pages should block (though this is an impossible\n // case in production).\n // - Dynamic pages should return their skeleton if not defined in\n // getStaticPaths, then finish the data request on the client-side.\n //\n if (\n process.env.NEXT_RUNTIME !== 'edge' &&\n !this.minimalMode &&\n fallbackMode !== FallbackMode.BLOCKING_STATIC_RENDER &&\n staticPathKey &&\n !didRespond &&\n !isPreviewMode &&\n isDynamic &&\n (isProduction || !staticPaths || !isPageIncludedInStaticPaths)\n ) {\n if (\n // In development, fall through to render to handle missing\n // getStaticPaths.\n (isProduction || (staticPaths && staticPaths?.length > 0)) &&\n // When fallback isn't present, abort this render so we 404\n fallbackMode === FallbackMode.NOT_FOUND\n ) {\n throw new NoFallbackError()\n }\n\n let fallbackResponse: ResponseCacheEntry | null | undefined\n\n // If this is a pages router page.\n if (isPagesRouteModule(components.routeModule) && !isNextDataRequest) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await this.responseCache.get(\n isProduction ? (locale ? `/${locale}${pathname}` : pathname) : null,\n // This is the response generator for the fallback shell.\n async ({\n previousCacheEntry: previousFallbackCacheEntry = null,\n }) => {\n // For the pages router, fallbacks cannot be revalidated or\n // generated in production. In the case of a missing fallback,\n // we return null, but if it's being revalidated, we just return\n // the previous fallback cache entry. This preserves the previous\n // behavior.\n if (isProduction) {\n return toResponseCacheEntry(previousFallbackCacheEntry)\n }\n\n // We pass `undefined` and `null` as it doesn't apply to the pages\n // router.\n return doRender({\n postponed: undefined,\n // For the pages router, fallbacks can only be generated on\n // demand in development, so if we're not in production, and we\n // aren't a app path.\n pagesFallback: true,\n fallbackRouteParams: null,\n })\n },\n {\n routeKind: RouteKind.PAGES,\n incrementalCache,\n isRoutePPREnabled,\n isFallback: true,\n }\n )\n }\n // If this is a app router page, PPR is enabled, and PFPR is also\n // enabled, then we should use the fallback renderer.\n else if (\n isRoutePPREnabled &&\n isAppPageRouteModule(components.routeModule) &&\n !isRSCRequest\n ) {\n // We use the response cache here to handle the revalidation and\n // management of the fallback shell.\n fallbackResponse = await this.responseCache.get(\n isProduction ? pathname : null,\n // This is the response generator for the fallback shell.\n async () =>\n doRender({\n // We pass `undefined` as rendering a fallback isn't resumed\n // here.\n postponed: undefined,\n pagesFallback: undefined,\n fallbackRouteParams:\n // If we're in production of we're debugging the fallback\n // shell then we should postpone when dynamic params are\n // accessed.\n isProduction || isDebugFallbackShell\n ? getFallbackRouteParams(pathname)\n : null,\n }),\n {\n routeKind: RouteKind.APP_PAGE,\n incrementalCache,\n isRoutePPREnabled,\n isFallback: true,\n }\n )\n }\n\n // If the fallback response was set to null, then we should return null.\n if (fallbackResponse === null) return null\n\n // Otherwise, if we did get a fallback response, we should return it.\n if (fallbackResponse) {\n // Remove the cache control from the response to prevent it from being\n // used in the surrounding cache.\n delete fallbackResponse.cacheControl\n\n return fallbackResponse\n }\n }\n\n // Only requests that aren't revalidating can be resumed. If we have the\n // minimal postponed data, then we should resume the render with it.\n const postponed =\n !isOnDemandRevalidate && !isRevalidating && minimalPostponed\n ? minimalPostponed\n : undefined\n\n // When we're in minimal mode, if we're trying to debug the static shell,\n // we should just return nothing instead of resuming the dynamic render.\n if (\n (isDebugStaticShell || isDebugDynamicAccesses) &&\n typeof postponed !== 'undefined'\n ) {\n return {\n cacheControl: { revalidate: 1, expire: undefined },\n isFallback: false,\n value: {\n kind: CachedRouteKind.PAGES,\n html: RenderResult.fromStatic(''),\n pageData: {},\n headers: undefined,\n status: undefined,\n } satisfies CachedPageValue,\n }\n }\n\n // If this is a dynamic route with PPR enabled and the default route\n // matches were set, then we should pass the fallback route params to\n // the renderer as this is a fallback revalidation request.\n const fallbackRouteParams =\n isDynamic &&\n isRoutePPREnabled &&\n (getRequestMeta(req, 'didSetDefaultRouteMatches') ||\n isDebugFallbackShell)\n ? getFallbackRouteParams(pathname)\n : null\n\n // Perform the render.\n return doRender({\n postponed,\n pagesFallback: undefined,\n fallbackRouteParams,\n })\n }\n\n const cacheEntry = await this.responseCache.get(\n ssgCacheKey,\n responseGenerator,\n {\n routeKind:\n // If the route module is not defined, we can assume it's a page being\n // rendered and thus check isAppPath.\n routeModule?.definition.kind ??\n (isAppPath ? RouteKind.APP_PAGE : RouteKind.PAGES),\n incrementalCache,\n isOnDemandRevalidate,\n isPrefetch: req.headers.purpose === 'prefetch',\n isRoutePPREnabled,\n }\n )\n\n if (isPreviewMode) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n if (!cacheEntry) {\n if (ssgCacheKey && !(isOnDemandRevalidate && revalidateOnlyGenerated)) {\n // A cache entry might not be generated if a response is written\n // in `getInitialProps` or `getServerSideProps`, but those shouldn't\n // have a cache key. If we do have a cache key but we don't end up\n // with a cache entry, then either Next.js or the application has a\n // bug that needs fixing.\n throw new Error('invariant: cache entry required but not generated')\n }\n return null\n }\n\n // If we're not in minimal mode and the cache entry that was returned was a\n // app page fallback, then we need to kick off the dynamic shell generation.\n if (\n ssgCacheKey &&\n !this.minimalMode &&\n isRoutePPREnabled &&\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE &&\n cacheEntry.isFallback &&\n !isOnDemandRevalidate &&\n // When we're debugging the fallback shell, we don't want to regenerate\n // the route shell.\n !isDebugFallbackShell &&\n process.env.DISABLE_ROUTE_SHELL_GENERATION !== 'true'\n ) {\n scheduleOnNextTick(async () => {\n try {\n await this.responseCache.get(\n ssgCacheKey,\n () =>\n doRender({\n // We're an on-demand request, so we don't need to pass in the\n // fallbackRouteParams.\n fallbackRouteParams: null,\n pagesFallback: undefined,\n postponed: undefined,\n }),\n {\n routeKind: RouteKind.APP_PAGE,\n incrementalCache,\n isOnDemandRevalidate: true,\n isPrefetch: false,\n isRoutePPREnabled: true,\n }\n )\n } catch (err) {\n console.error('Error occurred while rendering dynamic shell', err)\n }\n })\n }\n\n const didPostpone =\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE &&\n typeof cacheEntry.value.postponed === 'string'\n\n if (\n isSSG &&\n // We don't want to send a cache header for requests that contain dynamic\n // data. If this is a Dynamic RSC request or wasn't a Prefetch RSC\n // request, then we should set the cache header.\n !isDynamicRSCRequest &&\n (!didPostpone || isPrefetchRSCRequest)\n ) {\n if (!this.minimalMode) {\n // set x-nextjs-cache header to match the header\n // we set for the image-optimizer\n res.setHeader(\n 'x-nextjs-cache',\n isOnDemandRevalidate\n ? 'REVALIDATED'\n : cacheEntry.isMiss\n ? 'MISS'\n : cacheEntry.isStale\n ? 'STALE'\n : 'HIT'\n )\n }\n // Set a header used by the client router to signal the response is static\n // and should respect the `static` cache staleTime value.\n res.setHeader(NEXT_IS_PRERENDER_HEADER, '1')\n }\n\n const { value: cachedData } = cacheEntry\n\n // If the cache value is an image, we should error early.\n if (cachedData?.kind === CachedRouteKind.IMAGE) {\n throw new InvariantError('SSG should not return an image cache value')\n }\n\n // Coerce the cache control parameter from the render.\n let cacheControl: CacheControl | undefined\n\n // If this is a resume request in minimal mode it is streamed with dynamic\n // content and should not be cached.\n if (minimalPostponed) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this is in minimal mode and this is a flight request that isn't a\n // prefetch request while PPR is enabled, it cannot be cached as it contains\n // dynamic content.\n else if (\n this.minimalMode &&\n isRSCRequest &&\n !isPrefetchRSCRequest &&\n isRoutePPREnabled\n ) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (!this.renderOpts.dev || (hasServerProps && !isNextDataRequest)) {\n // If this is a preview mode request, we shouldn't cache it\n if (isPreviewMode) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n\n // If this isn't SSG, then we should set change the header only if it is\n // not set already.\n else if (!isSSG) {\n if (!res.getHeader('Cache-Control')) {\n cacheControl = { revalidate: 0, expire: undefined }\n }\n }\n\n // If we are rendering the 404 page we derive the cache-control\n // revalidate period from the value that trigged the not found\n // to be rendered. So if `getStaticProps` returns\n // { notFound: true, revalidate 60 } the revalidate period should\n // be 60 but if a static asset 404s directly it should have a revalidate\n // period of 0 so that it doesn't get cached unexpectedly by a CDN\n else if (is404Page) {\n const notFoundRevalidate = getRequestMeta(req, 'notFoundRevalidate')\n\n cacheControl = {\n revalidate:\n typeof notFoundRevalidate === 'undefined' ? 0 : notFoundRevalidate,\n expire: undefined,\n }\n } else if (is500Page) {\n cacheControl = { revalidate: 0, expire: undefined }\n } else if (cacheEntry.cacheControl) {\n // If the cache entry has a cache control with a revalidate value that's\n // a number, use it.\n if (typeof cacheEntry.cacheControl.revalidate === 'number') {\n if (cacheEntry.cacheControl.revalidate < 1) {\n throw new Error(\n `Invalid revalidate configuration provided: ${cacheEntry.cacheControl.revalidate} < 1`\n )\n }\n\n cacheControl = {\n revalidate: cacheEntry.cacheControl.revalidate,\n expire:\n cacheEntry.cacheControl?.expire ?? this.nextConfig.expireTime,\n }\n }\n // Otherwise if the revalidate value is false, then we should use the\n // cache time of one year.\n else {\n cacheControl = { revalidate: CACHE_ONE_YEAR, expire: undefined }\n }\n }\n }\n\n cacheEntry.cacheControl = cacheControl\n\n if (\n typeof segmentPrefetchHeader === 'string' &&\n cachedData?.kind === CachedRouteKind.APP_PAGE &&\n cachedData.segmentData\n ) {\n // This is a prefetch request issued by the client Segment Cache. These\n // should never reach the application layer (lambda). We should either\n // respond from the cache (HIT) or respond with 204 No Content (MISS).\n\n // Set a header to indicate that PPR is enabled for this route. This\n // lets the client distinguish between a regular cache miss and a cache\n // miss due to PPR being disabled. In other contexts this header is used\n // to indicate that the response contains dynamic data, but here we're\n // only using it to indicate that the feature is enabled — the segment\n // response itself contains whether the data is dynamic.\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '2')\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (this.minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n const matchedSegment = cachedData.segmentData.get(segmentPrefetchHeader)\n if (matchedSegment !== undefined) {\n // Cache hit\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(matchedSegment),\n // TODO: Eventually this should use cache control of the individual\n // segment, not the whole page.\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // Cache miss. Either a cache entry for this route has not been generated\n // (which technically should not be possible when PPR is enabled, because\n // at a minimum there should always be a fallback entry) or there's no\n // match for the requested segment. Respond with a 204 No Content. We\n // don't bother to respond with 404, because these requests are only\n // issued as part of a prefetch.\n res.statusCode = 204\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(''),\n cacheControl: cacheEntry?.cacheControl,\n }\n }\n\n // If there's a callback for `onCacheEntry`, call it with the cache entry\n // and the revalidate options.\n const onCacheEntry = getRequestMeta(req, 'onCacheEntry')\n if (onCacheEntry) {\n const finished = await onCacheEntry(\n {\n ...cacheEntry,\n // TODO: remove this when upstream doesn't\n // always expect this value to be \"PAGE\"\n value: {\n ...cacheEntry.value,\n kind:\n cacheEntry.value?.kind === CachedRouteKind.APP_PAGE\n ? 'PAGE'\n : cacheEntry.value?.kind,\n },\n },\n {\n url: getRequestMeta(req, 'initURL'),\n }\n )\n if (finished) {\n // TODO: maybe we have to end the request?\n return null\n }\n }\n\n if (!cachedData) {\n // add revalidate metadata before rendering 404 page\n // so that we can use this as source of truth for the\n // cache-control header instead of what the 404 page returns\n // for the revalidate value\n addRequestMeta(\n req,\n 'notFoundRevalidate',\n cacheEntry.cacheControl?.revalidate\n )\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n if (isNextDataRequest) {\n res.statusCode = 404\n res.body('{\"notFound\":true}').send()\n return null\n }\n\n if (this.renderOpts.dev) {\n addRequestMeta(req, 'developmentNotFoundSourcePage', pathname)\n }\n await this.render404(req, res, { pathname, query }, false)\n return null\n } else if (cachedData.kind === CachedRouteKind.REDIRECT) {\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control')) {\n res.setHeader(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n if (isNextDataRequest) {\n return {\n type: 'json',\n body: RenderResult.fromStatic(\n // @TODO: Handle flight data.\n JSON.stringify(cachedData.props)\n ),\n cacheControl: cacheEntry.cacheControl,\n }\n } else {\n await handleRedirect(cachedData.props)\n return null\n }\n } else if (cachedData.kind === CachedRouteKind.APP_ROUTE) {\n const headers = fromNodeOutgoingHttpHeaders(cachedData.headers)\n\n if (!(this.minimalMode && isSSG)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER)\n }\n\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (\n cacheEntry.cacheControl &&\n !res.getHeader('Cache-Control') &&\n !headers.get('Cache-Control')\n ) {\n headers.set(\n 'Cache-Control',\n getCacheControlHeader(cacheEntry.cacheControl)\n )\n }\n\n await sendResponse(\n req,\n res,\n new Response(cachedData.body, {\n headers,\n status: cachedData.status || 200,\n })\n )\n return null\n } else if (cachedData.kind === CachedRouteKind.APP_PAGE) {\n // If the request has a postponed state and it's a resume request we\n // should error.\n if (didPostpone && minimalPostponed) {\n throw new Error(\n 'Invariant: postponed state should not be present on a resume request'\n )\n }\n\n if (cachedData.headers) {\n const headers = { ...cachedData.headers }\n\n if (!this.minimalMode || !isSSG) {\n delete headers[NEXT_CACHE_TAGS_HEADER]\n }\n\n for (let [key, value] of Object.entries(headers)) {\n if (typeof value === 'undefined') continue\n\n if (Array.isArray(value)) {\n for (const v of value) {\n res.appendHeader(key, v)\n }\n } else if (typeof value === 'number') {\n value = value.toString()\n res.appendHeader(key, value)\n } else {\n res.appendHeader(key, value)\n }\n }\n }\n\n // Add the cache tags header to the response if it exists and we're in\n // minimal mode while rendering a static page.\n const tags = cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n if (this.minimalMode && isSSG && tags && typeof tags === 'string') {\n res.setHeader(NEXT_CACHE_TAGS_HEADER, tags)\n }\n\n // If the request is a data request, then we shouldn't set the status code\n // from the response because it should always be 200. This should be gated\n // behind the experimental PPR flag.\n if (cachedData.status && (!isRSCRequest || !isRoutePPREnabled)) {\n res.statusCode = cachedData.status\n }\n\n // Mark that the request did postpone.\n if (didPostpone) {\n res.setHeader(NEXT_DID_POSTPONE_HEADER, '1')\n }\n\n // we don't go through this block when preview mode is true\n // as preview mode is a dynamic request (bypasses cache) and doesn't\n // generate both HTML and payloads in the same request so continue to just\n // return the generated payload\n if (isRSCRequest && !isPreviewMode) {\n // If this is a dynamic RSC request, then stream the response.\n if (typeof cachedData.rscData === 'undefined') {\n if (cachedData.postponed) {\n throw new Error('Invariant: Expected postponed to be undefined')\n }\n\n return {\n type: 'rsc',\n body: cachedData.html,\n // Dynamic RSC responses cannot be cached, even if they're\n // configured with `force-static` because we have no way of\n // distinguishing between `force-static` and pages that have no\n // postponed state.\n // TODO: distinguish `force-static` from pages with no postponed state (static)\n cacheControl: isDynamicRSCRequest\n ? { revalidate: 0, expire: undefined }\n : cacheEntry.cacheControl,\n }\n }\n\n // As this isn't a prefetch request, we should serve the static flight\n // data.\n return {\n type: 'rsc',\n body: RenderResult.fromStatic(cachedData.rscData),\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // This is a request for HTML data.\n let body = cachedData.html\n\n // If there's no postponed state, we should just serve the HTML. This\n // should also be the case for a resume request because it's completed\n // as a server render (rather than a static render).\n if (!didPostpone || this.minimalMode) {\n return {\n type: 'html',\n body,\n cacheControl: cacheEntry.cacheControl,\n }\n }\n\n // If we're debugging the static shell or the dynamic API accesses, we\n // should just serve the HTML without resuming the render. The returned\n // HTML will be the static shell so all the Dynamic API's will be used\n // during static generation.\n if (isDebugStaticShell || isDebugDynamicAccesses) {\n // Since we're not resuming the render, we need to at least add the\n // closing body and html tags to create valid HTML.\n body.chain(\n new ReadableStream({\n start(controller) {\n controller.enqueue(ENCODED_TAGS.CLOSED.BODY_AND_HTML)\n controller.close()\n },\n })\n )\n\n return {\n type: 'html',\n body,\n cacheControl: { revalidate: 0, expire: undefined },\n }\n }\n\n // This request has postponed, so let's create a new transformer that the\n // dynamic data can pipe to that will attach the dynamic data to the end\n // of the response.\n const transformer = new TransformStream<Uint8Array, Uint8Array>()\n body.chain(transformer.readable)\n\n // Perform the render again, but this time, provide the postponed state.\n // We don't await because we want the result to start streaming now, and\n // we've already chained the transformer's readable to the render result.\n doRender({\n postponed: cachedData.postponed,\n pagesFallback: undefined,\n // This is a resume render, not a fallback render, so we don't need to\n // set this.\n fallbackRouteParams: null,\n })\n .then(async (result) => {\n if (!result) {\n throw new Error('Invariant: expected a result to be returned')\n }\n\n if (result.value?.kind !== CachedRouteKind.APP_PAGE) {\n throw new Error(\n `Invariant: expected a page response, got ${result.value?.kind}`\n )\n }\n\n // Pipe the resume result to the transformer.\n await result.value.html.pipeTo(transformer.writable)\n })\n .catch((err) => {\n // An error occurred during piping or preparing the render, abort\n // the transformers writer so we can terminate the stream.\n transformer.writable.abort(err).catch((e) => {\n console.error(\"couldn't abort transformer\", e)\n })\n })\n\n return {\n type: 'html',\n body,\n // We don't want to cache the response if it has postponed data because\n // the response being sent to the client it's dynamic parts are streamed\n // to the client on the same request.\n cacheControl: { revalidate: 0, expire: undefined },\n }\n } else if (isNextDataRequest) {\n return {\n type: 'json',\n body: RenderResult.fromStatic(JSON.stringify(cachedData.pageData)),\n cacheControl: cacheEntry.cacheControl,\n }\n } else {\n return {\n type: 'html',\n body: cachedData.html,\n cacheControl: cacheEntry.cacheControl,\n }\n }\n }\n\n private stripNextDataPath(path: string, stripLocale = true) {\n if (path.includes(this.buildId)) {\n const splitPath = path.substring(\n path.indexOf(this.buildId) + this.buildId.length\n )\n\n path = denormalizePagePath(splitPath.replace(/\\.json$/, ''))\n }\n\n if (this.localeNormalizer && stripLocale) {\n return this.localeNormalizer.normalize(path)\n }\n return path\n }\n\n // map the route to the actual bundle name\n protected getOriginalAppPaths(route: string) {\n if (this.enabledDirectories.app) {\n const originalAppPath = this.appPathRoutes?.[route]\n\n if (!originalAppPath) {\n return null\n }\n\n return originalAppPath\n }\n return null\n }\n\n protected async renderPageComponent(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n bubbleNoFallback: boolean\n ) {\n const { query, pathname } = ctx\n\n const appPaths = this.getOriginalAppPaths(pathname)\n const isAppPath = Array.isArray(appPaths)\n\n let page = pathname\n if (isAppPath) {\n // the last item in the array is the root page, if there are parallel routes\n page = appPaths[appPaths.length - 1]\n }\n\n const result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page,\n query,\n params: ctx.renderOpts.params || {},\n isAppPath,\n sriEnabled: !!this.nextConfig.experimental.sri?.algorithm,\n appPaths,\n // Ensuring for loading page component routes is done via the matcher.\n shouldEnsure: false,\n })\n if (result) {\n getTracer().setRootSpanAttribute('next.route', pathname)\n try {\n return await this.renderToResponseWithComponents(ctx, result)\n } catch (err) {\n const isNoFallbackError = err instanceof NoFallbackError\n\n if (!isNoFallbackError || (isNoFallbackError && bubbleNoFallback)) {\n throw err\n }\n }\n }\n return false\n }\n\n private async renderToResponse(\n ctx: RequestContext<ServerRequest, ServerResponse>\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(\n BaseServerSpan.renderToResponse,\n {\n spanName: `rendering page`,\n attributes: {\n 'next.route': ctx.pathname,\n },\n },\n async () => {\n return this.renderToResponseImpl(ctx)\n }\n )\n }\n\n protected abstract getMiddleware(): Promise<MiddlewareRoutingItem | undefined>\n protected abstract getFallbackErrorComponents(\n url?: string\n ): Promise<LoadComponentsReturnType | null>\n protected abstract getRoutesManifest(): NormalizedRouteManifest | undefined\n\n private async renderToResponseImpl(\n ctx: RequestContext<ServerRequest, ServerResponse>\n ): Promise<ResponsePayload | null> {\n const { req, res, query, pathname } = ctx\n let page = pathname\n const bubbleNoFallback =\n getRequestMeta(ctx.req, 'bubbleNoFallback') ?? false\n delete query[NEXT_RSC_UNION_QUERY]\n\n const options: MatchOptions = {\n i18n: this.i18nProvider?.fromRequest(req, pathname),\n }\n\n try {\n for await (const match of this.matchers.matchAll(pathname, options)) {\n // when a specific invoke-output is meant to be matched\n // ensure a prior dynamic route/page doesn't take priority\n const invokeOutput = getRequestMeta(ctx.req, 'invokeOutput')\n if (\n !this.minimalMode &&\n typeof invokeOutput === 'string' &&\n isDynamicRoute(invokeOutput || '') &&\n invokeOutput !== match.definition.pathname\n ) {\n continue\n }\n\n const result = await this.renderPageComponent(\n {\n ...ctx,\n pathname: match.definition.pathname,\n renderOpts: {\n ...ctx.renderOpts,\n params: match.params,\n },\n },\n bubbleNoFallback\n )\n if (result !== false) return result\n }\n\n // currently edge functions aren't receiving the x-matched-path\n // header so we need to fallback to matching the current page\n // when we weren't able to match via dynamic route to handle\n // the rewrite case\n // @ts-expect-error extended in child class web-server\n if (this.serverOptions.webServerConfig) {\n // @ts-expect-error extended in child class web-server\n ctx.pathname = this.serverOptions.webServerConfig.page\n const result = await this.renderPageComponent(ctx, bubbleNoFallback)\n if (result !== false) return result\n }\n } catch (error) {\n const err = getProperError(error)\n\n if (error instanceof MissingStaticPage) {\n console.error(\n 'Invariant: failed to load static page',\n JSON.stringify(\n {\n page,\n url: ctx.req.url,\n matchedPath: ctx.req.headers[MATCHED_PATH_HEADER],\n initUrl: getRequestMeta(ctx.req, 'initURL'),\n didRewrite: !!getRequestMeta(ctx.req, 'rewroteURL'),\n rewroteUrl: getRequestMeta(ctx.req, 'rewroteURL'),\n },\n null,\n 2\n )\n )\n throw err\n }\n\n if (err instanceof NoFallbackError && bubbleNoFallback) {\n throw err\n }\n if (err instanceof DecodeError || err instanceof NormalizeError) {\n res.statusCode = 400\n return await this.renderErrorToResponse(ctx, err)\n }\n\n res.statusCode = 500\n\n // if pages/500 is present we still need to trigger\n // /_error `getInitialProps` to allow reporting error\n if (await this.hasPage('/500')) {\n addRequestMeta(ctx.req, 'customErrorRender', true)\n await this.renderErrorToResponse(ctx, err)\n removeRequestMeta(ctx.req, 'customErrorRender')\n }\n\n const isWrappedError = err instanceof WrappedBuildError\n\n if (!isWrappedError) {\n if (\n (this.minimalMode && process.env.NEXT_RUNTIME !== 'edge') ||\n this.renderOpts.dev\n ) {\n if (isError(err)) err.page = page\n throw err\n }\n this.logError(getProperError(err))\n }\n const response = await this.renderErrorToResponse(\n ctx,\n isWrappedError ? (err as WrappedBuildError).innerError : err\n )\n return response\n }\n\n const middleware = await this.getMiddleware()\n if (\n middleware &&\n !!ctx.req.headers['x-nextjs-data'] &&\n (!res.statusCode || res.statusCode === 200 || res.statusCode === 404)\n ) {\n const locale = getRequestMeta(req, 'locale')\n\n res.setHeader(\n 'x-nextjs-matched-path',\n `${locale ? `/${locale}` : ''}${pathname}`\n )\n res.statusCode = 200\n res.setHeader('content-type', 'application/json')\n res.body('{}')\n res.send()\n return null\n }\n\n res.statusCode = 404\n return this.renderErrorToResponse(ctx, null)\n }\n\n public async renderToHTML(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return getTracer().trace(BaseServerSpan.renderToHTML, async () => {\n return this.renderToHTMLImpl(req, res, pathname, query)\n })\n }\n\n private async renderToHTMLImpl(\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return this.getStaticHTML((ctx) => this.renderToResponse(ctx), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async renderError(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise<void> {\n return getTracer().trace(BaseServerSpan.renderError, async () => {\n return this.renderErrorImpl(err, req, res, pathname, query, setHeaders)\n })\n }\n\n private async renderErrorImpl(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: NextParsedUrlQuery = {},\n setHeaders = true\n ): Promise<void> {\n if (setHeaders) {\n res.setHeader(\n 'Cache-Control',\n 'private, no-cache, no-store, max-age=0, must-revalidate'\n )\n }\n\n return this.pipe(\n async (ctx) => {\n const response = await this.renderErrorToResponse(ctx, err)\n if (this.minimalMode && res.statusCode === 500) {\n throw err\n }\n return response\n },\n { req, res, pathname, query }\n )\n }\n\n private customErrorNo404Warn = execOnce(() => {\n Log.warn(\n `You have added a custom /_error page without a custom /404 page. This prevents the 404 page from being auto statically optimized.\\nSee here for info: https://nextjs.org/docs/messages/custom-error-no-custom-404`\n )\n })\n\n private async renderErrorToResponse(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n err: Error | null\n ): Promise<ResponsePayload | null> {\n return getTracer().trace(BaseServerSpan.renderErrorToResponse, async () => {\n return this.renderErrorToResponseImpl(ctx, err)\n })\n }\n\n protected async renderErrorToResponseImpl(\n ctx: RequestContext<ServerRequest, ServerResponse>,\n err: Error | null\n ): Promise<ResponsePayload | null> {\n // Short-circuit favicon.ico in development to avoid compiling 404 page when the app has no favicon.ico.\n // Since favicon.ico is automatically requested by the browser.\n if (this.renderOpts.dev && ctx.pathname === '/favicon.ico') {\n return {\n type: 'html',\n body: RenderResult.fromStatic(''),\n }\n }\n const { res, query } = ctx\n\n try {\n let result: null | FindComponentsResult = null\n\n const is404 = res.statusCode === 404\n let using404Page = false\n\n if (is404) {\n if (this.enabledDirectories.app) {\n // Use the not-found entry in app directory\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,\n query,\n params: {},\n isAppPath: true,\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n\n if (!result && (await this.hasPage('/404'))) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/404',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 404 route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n using404Page = result !== null\n }\n }\n let statusPage = `/${res.statusCode}`\n\n if (\n !getRequestMeta(ctx.req, 'customErrorRender') &&\n !result &&\n STATIC_STATUS_PAGES.includes(statusPage)\n ) {\n // skip ensuring /500 in dev mode as it isn't used and the\n // dev overlay is used instead\n if (statusPage !== '/500' || !this.renderOpts.dev) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: statusPage,\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" a 500\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n }\n }\n\n if (!result) {\n result = await this.findPageComponents({\n locale: getRequestMeta(ctx.req, 'locale'),\n page: '/_error',\n query,\n params: {},\n isAppPath: false,\n // Ensuring can't be done here because you never \"match\" an error\n // route.\n shouldEnsure: true,\n url: ctx.req.url,\n })\n statusPage = '/_error'\n }\n\n if (\n process.env.NODE_ENV !== 'production' &&\n !using404Page &&\n (await this.hasPage('/_error')) &&\n !(await this.hasPage('/404'))\n ) {\n this.customErrorNo404Warn()\n }\n\n if (!result) {\n // this can occur when a project directory has been moved/deleted\n // which is handled in the parent process in development\n if (this.renderOpts.dev) {\n return {\n type: 'html',\n // wait for dev-server to restart before refreshing\n body: RenderResult.fromStatic(\n `\n <pre>missing required error components, refreshing...</pre>\n <script>\n async function check() {\n const res = await fetch(location.href).catch(() => ({}))\n\n if (res.status === 200) {\n location.reload()\n } else {\n setTimeout(check, 1000)\n }\n }\n check()\n </script>`\n ),\n }\n }\n\n throw new WrappedBuildError(\n new Error('missing required error components')\n )\n }\n\n // If the page has a route module, use it for the new match. If it doesn't\n // have a route module, remove the match.\n if (result.components.routeModule) {\n addRequestMeta(ctx.req, 'match', {\n definition: result.components.routeModule.definition,\n params: undefined,\n })\n } else {\n removeRequestMeta(ctx.req, 'match')\n }\n\n try {\n return await this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: statusPage,\n renderOpts: {\n ...ctx.renderOpts,\n err,\n },\n },\n result\n )\n } catch (maybeFallbackError) {\n if (maybeFallbackError instanceof NoFallbackError) {\n throw new Error('invariant: failed to render error page')\n }\n throw maybeFallbackError\n }\n } catch (error) {\n const renderToHtmlError = getProperError(error)\n const isWrappedError = renderToHtmlError instanceof WrappedBuildError\n if (!isWrappedError) {\n this.logError(renderToHtmlError)\n }\n res.statusCode = 500\n const fallbackComponents = await this.getFallbackErrorComponents(\n ctx.req.url\n )\n\n if (fallbackComponents) {\n // There was an error, so use it's definition from the route module\n // to add the match to the request.\n addRequestMeta(ctx.req, 'match', {\n definition: fallbackComponents.routeModule!.definition,\n params: undefined,\n })\n\n return this.renderToResponseWithComponents(\n {\n ...ctx,\n pathname: '/_error',\n renderOpts: {\n ...ctx.renderOpts,\n // We render `renderToHtmlError` here because `err` is\n // already captured in the stacktrace.\n err: isWrappedError\n ? renderToHtmlError.innerError\n : renderToHtmlError,\n },\n },\n {\n query,\n components: fallbackComponents,\n }\n )\n }\n return {\n type: 'html',\n body: RenderResult.fromStatic('Internal Server Error'),\n }\n }\n }\n\n public async renderErrorToHTML(\n err: Error | null,\n req: ServerRequest,\n res: ServerResponse,\n pathname: string,\n query: ParsedUrlQuery = {}\n ): Promise<string | null> {\n return this.getStaticHTML((ctx) => this.renderErrorToResponse(ctx, err), {\n req,\n res,\n pathname,\n query,\n })\n }\n\n public async render404(\n req: ServerRequest,\n res: ServerResponse,\n parsedUrl?: Pick<NextUrlWithParsedQuery, 'pathname' | 'query'>,\n setHeaders = true\n ): Promise<void> {\n const { pathname, query } = parsedUrl ? parsedUrl : parseUrl(req.url!, true)\n\n // Ensure the locales are provided on the request meta.\n if (this.nextConfig.i18n) {\n if (!getRequestMeta(req, 'locale')) {\n addRequestMeta(req, 'locale', this.nextConfig.i18n.defaultLocale)\n }\n addRequestMeta(req, 'defaultLocale', this.nextConfig.i18n.defaultLocale)\n }\n\n res.statusCode = 404\n return this.renderError(null, req, res, pathname!, query, setHeaders)\n }\n}\n"],"names":["getFallbackRouteParams","CachedRouteKind","NormalizeError","DecodeError","normalizeRepeatedSlashes","MissingStaticPage","format","formatUrl","parse","parseUrl","formatHostname","getRedirectStatus","isEdgeRuntime","APP_PATHS_MANIFEST","NEXT_BUILTIN_DOCUMENT","PAGES_MANIFEST","STATIC_STATUS_PAGES","UNDERSCORE_NOT_FOUND_ROUTE","UNDERSCORE_NOT_FOUND_ROUTE_ENTRY","isDynamicRoute","checkIsOnDemandRevalidate","setConfig","getCacheControlHeader","execOnce","isBlockedPage","getBotType","isBot","RenderResult","removeTrailingSlash","denormalizePagePath","Log","getPreviouslyRevalidatedTags","getUtils","isError","getProperError","addRequestMeta","getRequestMeta","removeRequestMeta","setRequestMeta","removePathPrefix","normalizeAppPath","getHostname","parseUrlUtil","getNextPathnameInfo","RSC_HEADER","NEXT_RSC_UNION_QUERY","NEXT_ROUTER_PREFETCH_HEADER","NEXT_ROUTER_SEGMENT_PREFETCH_HEADER","NEXT_DID_POSTPONE_HEADER","NEXT_URL","NEXT_IS_PRERENDER_HEADER","LocaleRouteNormalizer","DefaultRouteMatcherManager","AppPageRouteMatcherProvider","AppRouteRouteMatcherProvider","PagesAPIRouteMatcherProvider","PagesRouteMatcherProvider","ServerManifestLoader","getTracer","isBubbledError","SpanKind","BaseServerSpan","I18NProvider","sendResponse","fromNodeOutgoingHttpHeaders","normalizeNextQueryParam","toNodeOutgoingHttpHeaders","CACHE_ONE_YEAR","INFINITE_CACHE","MATCHED_PATH_HEADER","NEXT_CACHE_TAGS_HEADER","NEXT_RESUME_HEADER","normalizeLocalePath","NextRequestAdapter","signalFromNodeResponse","matchNextDataPathname","getRouteFromAssetPath","decodePathParams","RSCPathnameNormalizer","stripFlightHeaders","isAppPageRouteModule","isAppRouteRouteModule","isPagesRouteModule","PrefetchRSCPathnameNormalizer","NextDataPathnameNormalizer","getIsPossibleServerAction","isInterceptionRouteAppPath","toRoute","isNodeNextRequest","isNodeNextResponse","patchSetHeaderWithCookieSupport","checkIsAppPPREnabled","getBuiltinRequestContext","ENCODED_TAGS","NextRequestHint","getRevalidateReason","RouteKind","FallbackMode","parseFallbackField","toResponseCacheEntry","scheduleOnNextTick","SegmentPrefixRSCPathnameNormalizer","shouldServeStreamingMetadata","isHtmlBotRequest","InvariantError","decodeQueryPathParameter","getCacheHandlers","NoFallbackError","Error","WrappedBuildError","constructor","innerError","Server","getServerComponentsHmrCache","nextConfig","experimental","serverComponentsHmrCache","globalThis","__serverComponentsHmrCache","undefined","options","handleRSCRequest","req","_res","parsedUrl","pathname","normalizers","segmentPrefetchRSC","match","result","extract","originalPathname","segmentPath","headers","toLowerCase","prefetchRSC","normalize","rsc","segmentPrefetchRSCRequest","url","parsed","handleNextDataRequest","res","middleware","getMiddleware","params","path","buildId","process","env","NEXT_RUNTIME","render404","shift","lastParam","length","endsWith","join","trailingSlash","substring","i18nProvider","hostname","host","split","domainLocale","detectDomainLocale","defaultLocale","config","localePathResult","analyze","detectedLocale","handleNextImageRequest","handleCatchallRenderRequest","handleCatchallMiddlewareRequest","data","push","normalizer","normalizeAndAttachMetadata","finished","enabledDirectories","pages","prepared","preparedPromise","customErrorNo404Warn","warn","dir","quiet","conf","dev","minimalMode","port","experimentalTestProxy","serverOptions","require","resolve","loadEnvConfig","fetchHostname","distDir","publicDir","getPublicDir","hasStaticDir","getHasStaticDir","i18n","locales","localeNormalizer","serverRuntimeConfig","publicRuntimeConfig","assetPrefix","generateEtags","getBuildId","minimalModeKey","NEXT_PRIVATE_MINIMAL_MODE","getEnabledDirectories","isAppPPREnabled","app","ppr","isAppSegmentPrefetchEnabled","clientSegmentCache","nextFontManifest","getNextFontManifest","NEXT_DEPLOYMENT_ID","deploymentId","renderOpts","supportsDynamicResponse","strictNextHead","poweredByHeader","canonicalBase","amp","previewProps","getPrerenderManifest","preview","ampOptimizerConfig","optimizer","basePath","images","optimizeCss","nextConfigOutput","output","nextScriptWorkers","disableOptimizedLoading","domainLocales","domains","serverComponents","cacheLifeProfiles","cacheLife","enableTainting","taint","crossOrigin","largePageDataBytes","runtimeConfig","Object","keys","isExperimentalCompile","htmlLimitedBots","expireTime","clientTraceMetadata","dynamicIO","Boolean","dynamicOnHover","inlineCss","authInterrupts","onInstrumentationRequestError","instrumentationOnRequestError","bind","reactMaxHeadersLength","pagesManifest","getPagesManifest","appPathsManifest","getAppPathsManifest","appPathRoutes","getAppPathRoutes","interceptionRoutePatterns","getinterceptionRoutePatterns","matchers","getRouteMatchers","reload","setAssetPrefix","responseCache","getResponseCache","reloadMatchers","manifestLoader","name","args","err","ctx","instrumentation","onRequestError","method","fromEntries","entries","handlerErr","console","error","logError","handleRequest","prepare","toUpperCase","tracer","withPropagatedContext","trace","spanName","kind","SERVER","attributes","span","handleRequestImpl","finally","isRSCRequest","setAttributes","statusCode","rootSpanAttributes","getRootSpanAttributes","get","route","updateName","originalRequest","waitTillReady","originalResponse","urlParts","urlNoQuery","cleanUrl","redirect","body","send","query","URLSearchParams","xForwardedProto","isHttps","socket","encrypted","toString","remoteAddress","attachRequestMeta","replace","pathnameInfo","useMatchedPathHeader","matchedPath","URL","urlPathname","chunk","postponed","Buffer","concat","normalizedUrlPath","stripNextDataPath","localeAnalysisResult","inferredFromDefault","srcPathname","pageIsDynamic","paramsResult","hasValidParams","definition","utils","page","rewrites","getRoutesManifest","beforeFiles","afterFiles","fallback","caseSensitive","caseSensitiveRoutes","locale","originQueryParams","pathnameBeforeRewrite","rewriteParamKeys","handleRewrites","queryParams","didRewrite","routeParamKeys","Set","key","value","normalizedKey","add","Array","isArray","map","v","normalizeDynamicRouteParams","matcherParams","dynamicRouteMatcher","assign","curParamsResult","routeMatchesHeader","routeMatches","getParamsFromRouteMatches","defaultRouteMatches","interpolateDynamicPath","normalizeCdnUrl","defaultRouteRegex","groups","renderError","webServerConfig","protocol","parsedFullUrl","incrementalCache","getIncrementalCache","requestHeaders","requestProtocol","resetRequestCache","__incrementalCache","cacheHandlers","Promise","all","cacheHandler","previouslyRevalidatedTags","previewModeId","receiveExpiredTags","invokePath","useInvokePath","invokeStatus","invokeQuery","parsedMatchedPath","invokePathnameInfo","parseData","normalizeResult","response","Response","bubble","run","code","getRequestHandlerWithMetadata","meta","handler","getRequestHandler","prefix","loadInstrumentationModule","prepareImpl","then","close","forEach","entry","normalizedPath","runImpl","pipe","fn","partialContext","pipeImpl","ua","botType","serveStreamingMetadata","payload","originalStatus","type","cacheControl","sent","setHeader","expire","sendRenderResult","getStaticHTML","toUnchunkedString","render","internalRender","renderImpl","getWaitUntil","builtinRequestContext","waitUntil","getInternalWaitUntil","startsWith","customServer","hasPage","renderToResponse","getStaticPaths","fallbackField","dynamicRoutes","staticPaths","fallbackMode","renderToResponseWithComponents","requestContext","findComponentsResult","renderToResponseWithComponentsImpl","pathCouldBeIntercepted","resolvedPathname","some","regexp","test","setVaryHeader","isAppPath","addedNextUrlToVary","appendHeader","opts","components","prerenderManifest","cacheEntry","isErrorPathname","is404Page","is500Page","hasServerProps","getServerSideProps","hasGetStaticPaths","isPossibleServerAction","hasGetInitialProps","Component","getInitialProps","isSSG","getStaticProps","resolvedUrlPathname","hasFallback","isDynamic","pathsResult","resolvedWithoutSlash","includes","routes","isNextDataRequest","isPrefetchRSCRequest","routeModule","couldSupportPPR","hasDebugStaticShellQuery","__NEXT_EXPERIMENTAL_STATIC_SHELL_DEBUGGING","__nextppronly","hasDebugFallbackShellQuery","isRoutePPREnabled","renderingMode","isDebugStaticShell","isDebugDynamicAccesses","isDebugFallbackShell","minimalPostponed","isDynamicRSCRequest","segmentPrefetchHeader","isHtmlBot","parseInt","slice","fromStatic","isBotRequest","isSupportedDocument","Document","previewData","isPreviewMode","tryGetPreviewData","multiZoneDraftMode","runtime","isOnDemandRevalidate","revalidateOnlyGenerated","handleRedirect","pageData","destination","pageProps","__N_REDIRECT","__N_REDIRECT_STATUS","__N_REDIRECT_BASE_PATH","ssgCacheKey","doRender","pagesFallback","fallbackRouteParams","origQuery","hadTrailingSlash","resolvedUrl","shouldWaitOnAllReady","isRevalidate","serverActions","resolvedAsPath","isDraftMode","onClose","onAfterTaskError","setIsrStatus","nextExport","isStaticGeneration","context","sharedContext","request","fromNodeNextRequest","handle","fetchMetrics","cacheTags","collectedTags","blob","revalidate","collectedRevalidate","collectedExpire","APP_ROUTE","status","from","arrayBuffer","isFallback","pendingWaitUntil","routerKind","routePath","routeType","revalidateReason","clientReferenceManifest","renderContext","developmentNotFoundSourcePage","module","warmup","metadata","devRenderResumeDataCache","renderHTML","fetchTags","staticBailoutInfo","description","stack","message","indexOf","isNotFound","isRedirect","REDIRECT","props","flightData","isNull","APP_PAGE","html","rscData","segmentData","PAGES","responseGenerator","hasResolved","previousCacheEntry","isRevalidating","isProduction","didRespond","NOT_FOUND","PRERENDER","BLOCKING_STATIC_RENDER","isStale","staticPathKey","isPageIncludedInStaticPaths","fallbackResponse","previousFallbackCacheEntry","routeKind","isPrefetch","purpose","DISABLE_ROUTE_SHELL_GENERATION","didPostpone","isMiss","cachedData","IMAGE","getHeader","notFoundRevalidate","tags","matchedSegment","onCacheEntry","JSON","stringify","delete","set","chain","ReadableStream","start","controller","enqueue","CLOSED","BODY_AND_HTML","transformer","TransformStream","readable","pipeTo","writable","catch","abort","e","stripLocale","splitPath","getOriginalAppPaths","originalAppPath","renderPageComponent","bubbleNoFallback","appPaths","findPageComponents","sriEnabled","sri","algorithm","shouldEnsure","setRootSpanAttribute","isNoFallbackError","renderToResponseImpl","fromRequest","matchAll","invokeOutput","initUrl","rewroteUrl","renderErrorToResponse","isWrappedError","renderToHTML","renderToHTMLImpl","setHeaders","renderErrorImpl","renderErrorToResponseImpl","is404","using404Page","statusPage","NODE_ENV","maybeFallbackError","renderToHtmlError","fallbackComponents","getFallbackErrorComponents","renderErrorToHTML"],"mappings":"AAIA,SAEEA,sBAAsB,QACjB,4BAA2B;AAalC,SAOEC,eAAe,QAEV,mBAAkB;AAEzB,SACEC,cAAc,EACdC,WAAW,EACXC,wBAAwB,EACxBC,iBAAiB,QACZ,sBAAqB;AA2B5B,SAASC,UAAUC,SAAS,EAAEC,SAASC,QAAQ,QAAQ,MAAK;AAC5D,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,cAAc,EACdC,mBAAmB,EACnBC,0BAA0B,EAC1BC,gCAAgC,QAC3B,0BAAyB;AAChC,SAASC,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,yBAAyB,QAAQ,cAAa;AACvD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAA2B,sBAAqB;AAC9E,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,aAAa,QAAQ,UAAS;AAC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