Next.js Discord

Discord Forum

Problem with dynamic routes and error 500

Unanswered
American Sable posted this in #help-forum
Open in Discord
American SableOP
Hello,

I am having a problem with dynamic routes. I still use the pages router and I am using Prismic as a headless CMS, but I don’t think it matters.

I have this route, which statically generates pages.

/pages/[uid]/index.js

Locally, it works perfect. That means:

http://localhost:3000/xxx

works as expected and

http://localhost:3000/[uid]

goes to 404, but when I go to production,

https://www.example.com/[uid]

Generates an error 500. I deploy in Vercel. I check the logs and they say “Error: cannot find module /var/task/.next/server/pages/index.js”

I have been trying to solve this problem for a while, is anyone kind enough to hint me in the right direction?

Thanks! 🙏

0 Replies