404 when navigating directly to dynamic Next.js route

Hi there

I have deployed a Next.js project to Cloudflare Pages. It has several dynamic routes, an example is /pages/projects/<id>. My folder structure for said route is pages/projects/[id].tsx. This setup works fine locally, however, on Cloudflare pages I get 404 errors whenever I access specific project pages directly (e.g. when reloading - generally when I don’t navigate to them using the Next.js <Link> tags).

While I am no Next.js or Cloudflare Pages expert I suspect the issue revolves around the fact that individual project pages aren’t statically exported when building. It would be unfeasible for me to generate every single project page on build. These are served from a backend. Am I missing something or can I just not use Cloudflare Pages for this?

Good day!

It sounds like you’re running into:

Despite being closed, I do not think it’s resolved. I’d recommend updating that issue there or opening your own.