NextJS dynamic page with catch all route overrides all API routes

I've run into some trouble when using a catch all page routes on the top level (e.g. /pages/[...slug].tsx ). When trying to call any API route, it seems to route incorrectly to the catch all page instead of hitting the API endpoint. I've tried doing local dev/builds and deployed to Vercel with the same codebase but haven't been able to reproduce it in all other circumstances, so it looks like it only affects @cloudflare/next-on-pages builds. Has anyone encountered this problem before? Regular catch all page: https://dynamic-routes-api-404.pages.dev/home/page/ https://dynamic-routes-api-404.vercel.app/home/page/ API route: https://dynamic-routes-api-404.pages.dev/api/hello/ (loads catch all page) https://dynamic-routes-api-404.vercel.app/api/hello/ (loads API route) Repo for repro: https://github.com/fong/dynamic-routes-api-404
GitHub
GitHub - fong/dynamic-routes-api-404
Contribute to fong/dynamic-routes-api-404 development by creating an account on GitHub.
3 Replies
SundriedTofu
SundriedTofuOP12mo ago
GitHub
GitHub - fong/dynamic-routes-api-404-app
Contribute to fong/dynamic-routes-api-404-app development by creating an account on GitHub.
James
James12mo ago
Please can you open an issue on the next-on-pages GitHub repository?
SundriedTofu
SundriedTofuOP12mo ago
GitHub
[🐛 Bug]: dynamic page with catch all route overrides all API routes...
next-on-pages environment related information System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 CPU:...
Want results from more Discord servers?
Add your server