[PPF] Fix self-hosted 500s when empty fallback shells miss the cache
A self-hosted `next start` app using `cacheComponents`, `partialPrefetching`, and a custom `cacheHandler` can return HTTP 500 when the handler misses both a generated route and its generic fallback. The server then tries to prerender the generic shell on demand. In the reproduction, `app/layout.tsx` defines the root layout, and `app/[locale]/page.tsx` defines `locale` beneath it as an ordinary dynamic parameter. `generateStaticParams()` supplies `/en` and `/fr`, but the page awaits `params` outside `<Suspense>`. This leaves the generic `/[locale]` HTML shell empty. The build permits that result because it prerenders the concrete routes. The custom handler stores entries in an in-process `Map`, which is empty when a new `next start` process starts. Its first `/en` request misses both `/en` and `/[locale]`; runtime validation rejects the attempt to regenerate the empty generic shell and returns HTTP 500. The build now records whether the fallback HTML shell was empty. On a miss for an empty shell, `next start` generates the most specific eligible shell instead of prerendering the generic fallback again. The first request waits for that render. Nonempty fallbacks still serve immediately and upgrade in the background, preserving #91231 and its `partialPrefetching` gate from #96297. Fixes #98732
Showing
Please
register
or
sign in
to comment