{"record":{"id":"e098aa3cab5905d0","repo":"vercel/next.js","slug":"getinitialprops-in-document-component-is-not-sup","errorCode":null,"errorMessage":"`getInitialProps` in Document component is not supported with the Edge Runtime.","messagePattern":"`getInitialProps` in Document component is not supported with the Edge Runtime\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/render.tsx","lineNumber":1286,"sourceCode":"    return <div id=\"__next\">{children}</div>\n  }\n\n  const renderDocument = async () => {\n    // For `Document`, there are two cases that we don't support:\n    // 1. Using `Document.getInitialProps` in the Edge runtime.\n    // 2. Using the class component `Document` with concurrent features.\n\n    const BuiltinFunctionalDocument: DocumentType | undefined = (\n      Document as any\n    )[NEXT_BUILTIN_DOCUMENT]\n\n    if (process.env.NEXT_RUNTIME === 'edge' && Document.getInitialProps) {\n      // In the Edge runtime, `Document.getInitialProps` isn't supported.\n      // We throw an error here if it's customized.\n      if (BuiltinFunctionalDocument) {\n        Document = BuiltinFunctionalDocument\n      } else {\n        throw new Error(\n          '`getInitialProps` in Document component is not supported with the Edge Runtime.'\n        )\n      }\n    }\n\n    async function loadDocumentInitialProps(\n      renderShell: (\n        _App: AppType,\n        _Component: NextComponentType\n      ) => Promise<ReactDOMServerReadableStream>\n    ) {\n      const renderPage: RenderPage = async (\n        options: ComponentsEnhancer = {}\n      ): Promise<RenderPageResult> => {\n        if (ctx.err && ErrorDebug) {\n          // Always start rendering the shell even if there's an error.\n          if (renderShell) {\n            renderShell(App, Component)","sourceCodeStart":1268,"sourceCodeEnd":1304,"githubUrl":"https://github.com/vercel/next.js/blob/89d017eac43ebf4742ed2b58d3c1373b70283b69/packages/next/src/server/render.tsx#L1268-L1304","documentation":"Capability guard in renderToHTMLImpl's renderDocument path: when the process runs with NEXT_RUNTIME === 'edge' and the custom Document class defines getInitialProps, rendering is refused. The edge runtime does not execute Document.getInitialProps (document rendering is handled differently there), so the unsupported combination fails fast rather than silently mis-rendering.","triggerScenarios":"Thrown at packages/next/src/server/render.tsx:1288 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove `getInitialProps` from your custom Document, or stop using the Edge Runtime for this route."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89d017eac43ebf4742ed2b58d3c1373b70283b69","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}