next.js
70fb25d3 - fix: resolve function configs in unstable_getResponseFromNextConfig (#92501)

Commit
114 days ago
fix: resolve function configs in unstable_getResponseFromNextConfig (#92501) ## Summary - `unstable_getResponseFromNextConfig` now resolves async function configs before passing them to `loadCustomRoutes` - Uses `normalizeConfig` — the same utility Next.js already uses at build time to handle `(phase, ctx) => config` wrappers ## Problem Plugins that wrap `next.config.mjs` in an async function (e.g. `withSentry`, `withWorkflow`, `withMDX`) caused `unstable_getResponseFromNextConfig` to silently return `null` for all rewrites, redirects, and headers. The function config was passed directly to `loadCustomRoutes`, which accessed `.rewrites`/`.redirects` on a function object. ## Fix Call `normalizeConfig('phase-production-build', nextConfig)` before `loadCustomRoutes`. This is a 4-line change that makes the testing utility consistent with how Next.js resolves configs at build time. ## Test Added a test that passes an async function config with rewrites and redirects, verifying both are matched correctly. Fixes #92500 --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Author
Parents
Loading