Next.js Discord

Discord Forum

Vercel Next 13 ISR issue

Unanswered
White-horned horntail posted this in #help-forum
Open in Discord
White-horned horntailOP
I'm using Next 13 and generating static pages for all jobs (about 1300 pages) by using generateStaticParams. Locally everything seems to be working but after build in Vercel I face strange behaviour. All jobs that are created after build works locally but on Vercel work only by opening directly through URL, if you try to open job from main page by <Link /> component it returns 404. If I refresh the same page it shows correct info

31 Replies

hi try add below to the page
export const dynamicParams = true
White-horned horntailOP
I tried this but doesn't help, idk why locally after build it works but on vercel nope
can you share the url on vercel?
White-horned horntailOP
Unfortunately nope because it is commercial project and I cannot share the link. But I can provide some code pieces if it helps
ok, from the information you given, seem like the page is not generated at build time and generating on demand
so the first visit 404 and the page show correctly after
White-horned horntailOP
actually even after it was showed correctly (by refresh URL for example) if I go back to jobs list page and try to open the same page it still returns 404 and requires page refresh
I was thinking about moving generateStaticParams to layout instead of page but not sure if it makes sense
what is the path of the page?
one or multiple dynamic segment?
White-horned horntailOP
/jobs/:city/:slug/:id
ok where do you export the generateStaticParams
White-horned horntailOP
/jobs/[city]/[slug]/[id]/page.tsx
can you show the code of the generateStaticParams?
White-horned horntailOP
it work locally after next build?
White-horned horntailOP
yup
I tried to add new job in DB
and it works
there is the report after build
check the log on vercel and see if the report look the same
and the log here
White-horned horntailOP
Everything looks the same, and no errors in logs when 404 is returned
no idea, i don't get 404 with it
White-horned horntailOP
can the potential issue appear because I have [...notFound] route?
where is it?
could be
White-horned horntailOP
in the "app" folder, because vercel didn't see my not-found.tsx, so I added [...not-found]/page.tsx and it was fixed
and just call notFound() in it?
White-horned horntailOP
yup
it still works for me