404 on dynamic page only on Vercel, not in prod mode localhost
Unanswered
Grass carp posted this in #help-forum
Grass carpOP
I am using Pages Routes, when I deploy in Vercel my dynamic route /movies/[id].jsx throws a 404 error
28 Replies
Grass carpOP
This is my function: export async function getServerSideProps(contexto) {
const { id } = contexto.params;
const movies = await getMovie(id);
const cardMovies = await getMovies();
return {
props: {
movies,
cardMovies,
},
};
}
const { id } = contexto.params;
const movies = await getMovie(id);
const cardMovies = await getMovies();
return {
props: {
movies,
cardMovies,
},
};
}
Sun bear
If I was you, I would try to explain the issue in english, that would probably greatly increase your chances of getting an answer.
Grass carpOP
jajaajja sorry
can you make a minimal reproduction repository?
Grass carpOP
Of course
i dont think this is minimal reproduction
Grass carpOP
what do they mean then?
vercel?
he meant create a new repository where the bug persists
throwing away irrelevant code making it "minimal" and only focuses on the bug
Grass carpOP
Ah vale
which is due to you using
fallback inside gssp which is not allowedremoving the fallback prop gives me this
which i think is working well
an invalid id will give this page in development and likely a 500 page on deployment
which you can fix by updating
movie.service.js so it can handle invalid id as well@joulev which is due to you using `fallback` inside gssp which is not allowed
Grass carpOP
Sorry, I was testing. but without the fallback it doesn't work either
@joulev which you can fix by updating `movie.service.js` so it can handle invalid `id` as well
or this
export async function getServerSideProps(contexto) {
try {
const { id } = contexto.params;
const movies = await getMovie(id);
const cardMovies = await getMovies();
return {
props: {
movies,
cardMovies,
},
};
} catch {
return { notFound: true }
}
}@joulev removing the fallback prop gives me this
Grass carpOP
are you on localhost?
Grass carpOP
On localhost it works fine, but try this link: https://ssr-six-beta.vercel.app/
404
@Grass carp On localhost it works fine, but try this link: https://ssr-six-beta.vercel.app/
interesting, i can reproduce the bug too and dunno what's wrong
it should work
maybe you should try to contact [vercel help](https://vercel.com/help), this is probably a bug in vercel or nextjs
Grass carpOP
Okay, thanks for your time. I'm going to contact them