next.js
e6180250 - fix(server): fix pages router resume router matching (#84158)

Commit
135 days ago
fix(server): fix pages router resume router matching (#84158) ### What? Prevents PPR resume requests on Pages Router data routes by rejecting them with a 422 status code and adds debug cache entry handlers for testing PPR cache behavior in standalone mode. ### Why? PPR (Partial Pre-Rendering) is an App Router-specific feature that should not be used with Pages Router routes. When a request includes both: 1. PPR resume headers (`next-resume: 1`) 2. A Pages Router data route URL (`/_next/data/...`) This represents an invalid request combination that could cause unexpected behavior. The server should explicitly reject these unprocessable requests rather than attempting to handle them. Additionally, testing PPR cache behavior in standalone mode requires debug cache entry handlers that can track cache hits/misses during PPR rendering scenarios. ### How? **Main Fix (packages/next/src/server/base-server.ts:1102-1117):** - Added validation after parsing PPR resume headers to check if the request is also a next data request - If both conditions are true, immediately return HTTP 422 (Unprocessable Entity) with empty response - This prevents the request from proceeding to the render pipeline where it could cause issues **Debug Infrastructure:** - Added support for `NEXT_PRIVATE_DEBUG_CACHE_ENTRY_HANDLERS` environment variable in test mode - Enhanced build tracing and required server files manifest to include debug handlers - Modified render server to use debug cache entry handlers when available for testing PPR cache behavior
Author
Parents
Loading