Preserve error boundaries during on-demand prerendering (#99037)
In production, an error while generating an App Router page on demand can return a generic 500 response or a Pages Router 500 page instead of the route's `error.tsx` or `global-error.tsx`. This affects dynamic routes using `generateStaticParams`, even though their error boundaries work in development. A completed prerender failure now carries its error and recovery output through the renderer and response cache as an explicit result. The response cache retains completed failures within each platform invocation, without changing existing in-flight batching. Failed output is not persisted as a successful ISR entry. The server sends recovered documents with status 500 and non-cacheable headers. Failed RSC responses have empty bodies; navigation falls back to loading the document. Build failures and incomplete recovery continue to throw. Asynchronous error reporting runs in the background and uses the platform's `waitUntil` when available. Recovery that requires resuming a partially prerendered page is out of scope for this PR and continues to throw. A follow-up PR will preserve and resume that partial recovery output. The fix applies to self-hosted production servers and adapter-based Vercel deployments. The legacy Vercel deployment path retains its existing behavior of replacing the response with a generic error page. The tests cover both Cache Components settings, batched invocation failures, pending I/O inside Suspense, same-URL recovery, successful-page retention, and original-error reporting. Fixes #62046
Showing
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please
register
or
sign in
to comment