Next.js dynamic routes not working on Vercel Deployment
Unanswered
Alligator mississippiensis posted this in #help-forum
Alligator mississippiensisOP
I am using React with NextJS and Vercel for depolyment like the offcial tutorials. and When I implement dynamic routing, I made a
it work well locally in localhost:3000
but I failed deploy it on vercel and get error message:
please help
posts/[id] folder and with a simple page.tsx export default async function Page({ params }: { params: { id: string } }) {
return (
<main>
<div className="flex min-h-screen flex-col">
<h1>Page</h1>
</div>
</main>
);
}it work well locally in localhost:3000
but I failed deploy it on vercel and get error message:
Error: Unsupported output type: "undefined" for posts/[id].rscplease help
11 Replies
Can you try and make the type declaration as string | undefined
Alligator mississippiensisOP
export default async function Page({
params,
}: {
params: { id: string | undefined };
}) {
return (
<main>
<div className="flex min-h-screen flex-col">
<h1>Page</h1>
</div>
</main>
);
}like this?
I still got the same error
btw this is copilot helping, I tryied but it doesn't fix my problem, but might give some hint
Can you show your folder structure, also test on local prod build @Alligator mississippiensis
Alligator mississippiensisOP
Alligator mississippiensisOP
I always use development build and never try local production build
development build was fine.
and below is the prod build
I tried run
development build was fine.
and below is the prod build
I tried run
pnpm vercel build and got error Error: Unable to find lambda for route: /dashboard/invoicesand with normal
I got this
npm run buildI got this
Might be a vercel issue with next 15? Sorry no clue
Alligator mississippiensisOP
this is my blog project basically by modifying official tutorial project.
the tutorial project works fine and mine doesn't. then it should be something related with my modification.
I think I can find out the reason by some A/B testing and comparation.
thanks anyway!
the tutorial project works fine and mine doesn't. then it should be something related with my modification.
I think I can find out the reason by some A/B testing and comparation.
thanks anyway!
@Arinji Might be a vercel issue with next 15? Sorry no clue
Alligator mississippiensisOP
I found out the tutorial using Next 14.
I downgrade my project to 14 and disable experimental feature Partial Pre-Rendering, then successfully deploy on vercel.
this might be the reason
I downgrade my project to 14 and disable experimental feature Partial Pre-Rendering, then successfully deploy on vercel.
this might be the reason
@Alligator mississippiensis I found out the tutorial using Next 14.
I downgrade my project to 14 and disable experimental feature **Partial Pre-Rendering**, then successfully deploy on vercel.
this might be the reason
Yea, probs just an issue with 15. I would wait for it to be stable first