NextJS Dynamic Routes resulting in 500 error

You should be able to see in the logs in the Netlify dashboard what the actual error is.

What is your Next.js version? I had a Next.js application that would not deploy to Netlify successfully on any version past 13.4.19. The error was a strange one in the logs, but every page would result in a 500 error.

You might want to try a previous version, as Netlify is still working on supporting Next.js v14.