Duffer Derek
{"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 { 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_ROUTER_STATE_TREE_HEADER,\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_REVALIDATED_TAGS_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 { getIsServerAction } 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 { getCacheHandlers } from './use-cache/handlers'\nimport { InvariantError } from '../shared/lib/invariant-error'\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 ?? 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 // 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 // TODO: check if this is needed any more?\n matchedPath = denormalizePagePath(matchedPath)\n\n let srcPathname = matchedPath\n let pageIsDynamic = isDynamicRoute(srcPathname)\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 // The page is dynamic if the params are defined.\n pageIsDynamic = typeof match.params !== 'undefined'\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 const pathnameBeforeRewrite = parsedUrl.pathname\n const rewriteParamKeys = Object.keys(\n utils.handleRewrites(req, parsedUrl)\n )\n const didRewrite = pathnameBeforeRewrite !== parsedUrl.pathname\n\n if (didRewrite && parsedUrl.pathname) {\n addRequestMeta(req, 'rewroteURL', parsedUrl.pathname)\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\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\n if (typeof value === 'undefined') continue\n queryParams[normalizedKey] = value\n }\n\n // interpolate dynamic params and normalize URL if needed\n if (pageIsDynamic) {\n let params: ParsedUrlQuery | false = {}\n\n let paramsResult = utils.normalizeDynamicRouteParams(\n queryParams,\n false\n )\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.normalizeVercelUrl(req, [\n ...rewriteParamKeys,\n ...Object.keys(utils.defaultRouteRegex?.groups || {}),\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 // If the header is present, receive the expired tags from all the\n // cache handlers.\n const handlers = getCacheHandlers()\n if (handlers) {\n const header = req.headers[NEXT_CACHE_REVALIDATED_TAGS_HEADER]\n const expiredTags = typeof header === 'string' ? header.split(',') : []\n\n const promises: Promise<void>[] = []\n for (const handler of handlers) {\n promises.push(handler.receiveExpiredTags(...expiredTags))\n }\n\n // Only await if there are any promises to wait for.\n if (promises.length > 0) await Promise.all(promises)\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 const isBotRequest = isBot(ua)\n\n const ctx: RequestContext<ServerRequest, ServerResponse> = {\n ...partialContext,\n renderOpts: {\n ...this.renderOpts,\n supportsDynamicResponse: !isBotRequest,\n botType: getBotType(ua),\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 // 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 const baseVaryHeader = `${RSC_HEADER}, ${NEXT_ROUTER_STATE_TREE_HEADER}, ${NEXT_ROUTER_PREFETCH_HEADER}, ${NEXT_ROUTER_SEGMENT_PREFETCH_HEADER}`\n const isRSCRequest = getRequestMeta(req, 'isRSCRequest') ?? false\n\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', `${baseVaryHeader}, ${NEXT_URL}`)\n addedNextUrlToVary = true\n } else if (isAppPath || isRSCRequest) {\n // We don't need to include `Next-URL` in the Vary header for non-interception routes since it won't affect the response.\n // We also set this header for pages to avoid caching issues when navigating between pages and app.\n res.appendHeader('vary', baseVaryHeader)\n }\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 isServerAction = getIsServerAction(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 !isServerAction &&\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 !isServerAction &&\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 isServerAction,\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 !isServerAction\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 (\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 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 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 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 if (\n this.minimalMode &&\n isSSG &&\n cachedData.headers?.[NEXT_CACHE_TAGS_HEADER]\n ) {\n res.setHeader(\n NEXT_CACHE_TAGS_HEADER,\n cachedData.headers[NEXT_CACHE_TAGS_HEADER] as string\n )\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","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_ROUTER_STATE_TREE_HEADER","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_REVALIDATED_TAGS_HEADER","NEXT_CACHE_TAGS_HEADER","NEXT_RESUME_HEADER","normalizeLocalePath","NextRequestAdapter","signalFromNodeResponse","matchNextDataPathname","getRouteFromAssetPath","decodePathParams","RSCPathnameNormalizer","stripFlightHeaders","isAppPageRouteModule","isAppRouteRouteModule","isPagesRouteModule","PrefetchRSCPathnameNormalizer","NextDataPathnameNormalizer","getIsServerAction","isInterceptionRouteAppPath","toRoute","isNodeNextRequest","isNodeNextResponse","patchSetHeaderWithCookieSupport","checkIsAppPPREnabled","getBuiltinRequestContext","ENCODED_TAGS","NextRequestHint","getRevalidateReason","RouteKind","FallbackMode","parseFallbackField","toResponseCacheEntry","scheduleOnNextTick","SegmentPrefixRSCPathnameNormalizer","shouldServeStreamingMetadata","isHtmlBotRequest","getCacheHandlers","InvariantError","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","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","definition","utils","page","rewrites","getRoutesManifest","beforeFiles","afterFiles","fallback","caseSensitive","caseSensitiveRoutes","locale","pathnameBeforeRewrite","rewriteParamKeys","handleRewrites","didRewrite","queryParams","key","value","normalizedKey","paramsResult","normalizeDynamicRouteParams","hasValidParams","matcherParams","dynamicRouteMatcher","assign","curParamsResult","routeMatchesHeader","routeMatches","getParamsFromRouteMatches","defaultRouteMatches","interpolateDynamicPath","normalizeVercelUrl","defaultRouteRegex","groups","renderError","Boolean","webServerConfig","protocol","parsedFullUrl","incrementalCache","getIncrementalCache","requestHeaders","requestProtocol","resetRequestCache","__incrementalCache","handlers","header","expiredTags","promises","handler","receiveExpiredTags","Promise","all","invokePath","useInvokePath","invokeStatus","invokeQuery","parsedMatchedPath","invokePathnameInfo","parseData","normalizeResult","response","Response","bubble","run","code","getRequestHandlerWithMetadata","meta","getRequestHandler","prefix","loadInstrumentationModule","prepareImpl","then","close","forEach","entry","normalizedPath","runImpl","pipe","fn","partialContext","pipeImpl","ua","isBotRequest","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","baseVaryHeader","addedNextUrlToVary","appendHeader","opts","components","prerenderManifest","cacheEntry","isErrorPathname","is404Page","is500Page","hasServerProps","getServerSideProps","hasGetStaticPaths","isServerAction","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","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","matchedSegment","IMAGE","getHeader","notFoundRevalidate","onCacheEntry","JSON","stringify","delete","set","Array","isArray","v","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,qBAA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