vercel/next.js · error
`getInitialProps` in Document component is not supported wit
Error message
`getInitialProps` in Document component is not supported with the Edge Runtime.
What it means
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.
Source
Thrown at packages/next/src/server/render.tsx:1286
return <div id="__next">{children}</div>
}
const renderDocument = async () => {
// For `Document`, there are two cases that we don't support:
// 1. Using `Document.getInitialProps` in the Edge runtime.
// 2. Using the class component `Document` with concurrent features.
const BuiltinFunctionalDocument: DocumentType | undefined = (
Document as any
)[NEXT_BUILTIN_DOCUMENT]
if (process.env.NEXT_RUNTIME === 'edge' && Document.getInitialProps) {
// In the Edge runtime, `Document.getInitialProps` isn't supported.
// We throw an error here if it's customized.
if (BuiltinFunctionalDocument) {
Document = BuiltinFunctionalDocument
} else {
throw new Error(
'`getInitialProps` in Document component is not supported with the Edge Runtime.'
)
}
}
async function loadDocumentInitialProps(
renderShell: (
_App: AppType,
_Component: NextComponentType
) => Promise<ReactDOMServerReadableStream>
) {
const renderPage: RenderPage = async (
options: ComponentsEnhancer = {}
): Promise<RenderPageResult> => {
if (ctx.err && ErrorDebug) {
// Always start rendering the shell even if there's an error.
if (renderShell) {
renderShell(App, Component)View on GitHub (pinned to 89d017eac4)
Solutions
- Remove `getInitialProps` from your custom Document, or stop using the Edge Runtime for this route.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/next/src/server/render.tsx:1288 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/next.js@89d017eac4 (2026-08-19).
Data as JSON: /api/errors/e098aa3cab5905d0.
Report an issue: GitHub.