next.js
7dc7c98e - fix dynamic param extraction in edge-ssr-app (#83081)

Commit
195 days ago
fix dynamic param extraction in edge-ssr-app (#83081) Fixes edge runtime pages with dynamic routes returning 500 errors when the URL segment literally contains bracket syntax that matches the folder name (e.g., accessing `/[id]` for a route defined as `/[id]/page.tsx`). The removal of web-server.ts in #81389 modified how route params were extracted for dynamic routes. The route matcher in prepare() was being created with the full internal page path (e.g., /[id]/page) which generated a regex expecting /page at the end. However, actual URL pathnames don't include the /page suffix, causing the matcher to fail when trying to extract params. This issue specifically manifested when the URL contained literal brackets (like /[id]), as the fallback param extraction would fail and leave params empty, leading to the error. This PR normalizes the page path using before creating the route matcher in prepare(). This ensures the regex pattern matches the actual URL pathname format (without /page suffix). Fixes NEXT-4698
Author
Parents
Loading