next.js
804cbc41 - feat: add route context to prerender error messages (#82283)

Commit
210 days ago
feat: add route context to prerender error messages (#82283) ### What? This PR improves error debugging during prerendering by adding route context to hanging promise rejection errors and related error messages. ### Why? When developers encounter dynamic access issues during static generation, the current error messages don't provide enough context about which specific route is causing the problem. This makes debugging difficult, especially in large applications with many routes. By including route information in error messages, developers can quickly identify the problematic route and resolve the issue more efficiently. ### How? - Updates `makeHangingPromise` function signature to accept a `route` parameter - Modifies `HangingPromiseRejectionError` to include route information in error messages - Adds route context to all hanging promise calls across the codebase: - Dynamic rendering utilities - Fetch patching - Request APIs (cookies, headers, params, etc.) - Use cache wrapper - Adds new error code 773 for missing workStore scenarios - Ensures workStore validation where needed to prevent missing route context The changes are backward compatible and only enhance existing error messages with additional debugging information. ### Fixing a bug - Tests will be added in follow-up PR - Error messages now include helpful route context for debugging NAR-225
Author
Parents
Loading