SundriedTofu
SundriedTofu
CDCloudflare Developers
Created by SundriedTofu on 12/13/2023 in #pages-help
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
4 replies