Next.js Discord

Discord Forum

Deployment of Next.js app on Vercel failed and no error messages

Unanswered
Cuban Crocodile posted this in #help-forum
Open in Discord
Avatar
Cuban CrocodileOP
I am currently using the pages directory in Next.js 14.1.0, and our app is deployed on Vercel. Since yesterday, the deployment duration has increased from the previous 5 mins to 45+ mins, and most of the deployments are failing. No error messages are visible. 🤔

I have tried both Node 18 and Node 20, btw another identical project (same code for test environment) can build successfully and quickly. (API issues have been ruled out)

35 Replies

Avatar
Cuban CrocodileOP
During the slow build at around 70%, it suddenly terminates and indicates build failure with no visible error messages 🧐
Image
Image
Avatar
joulev
why are you generating 963 pages
that's why your build is slow
back in 14.0.x, what was the number of statically generated pages?
Avatar
Cuban CrocodileOP
The 963 pages include some pre-generated news pages (multi-languages), as you can see in the screenshot, if the build goes smoothly it can be completed within 5-6 mins
Image
Avatar
joulev
so in 14.0.x you still generated near 1k pages? interesting, never seen 1k pages being generated that fast before
Avatar
Cuban CrocodileOP
the minimum requirement in the project is Node 18 or above, but I think this issue is not related to the Node version 🤔
Avatar
joulev
i meant next@14.0.x, not node@14.0.x
Avatar
Cuban CrocodileOP
we have another vercel project with the same codebase, and the build is going smoothly
Avatar
joulev
since you says it went wrong from 14.1.0, im asking if it was the same number before 14.1.0
Avatar
Cuban CrocodileOP
oh sorry, got you point. but can't cannot explain this one
Avatar
joulev
honestly i don't know either. now 1k pages is a gigantic number and typically you don't want to generate that many; you may want to use [dynamicParams: true](https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams) to generate less important pages on-demand instead. but it's not relevant to the next version or why it works elsewhere but not here – about this part i don't have any ideas either
Avatar
Cuban CrocodileOP
We have tens of thousands of news articles, and currently, we have pre-generatea few hundred of them, and the rest will be generated on-demand based on ISR.

Since these news articles receive high traffic, we want them to be static and pre-generate so that they can respond as quickly as possible when the links are clicked
btw we are using pages dir at the moment
Avatar
joulev
oh didnt notice this, sorry
ok now this is something really strange and idk why it happens either
maybe try typical steps like rebuilding without cache
Avatar
Cuban CrocodileOP
this is the result of another vercel project under the same codebase, just deployed, the additional 2-3 mins are because the server we use for testing is not as robust as the prod env
Image
tried many times, but no luck 🥹
strangely after the build failure, there is no error message visible 👀
Avatar
joulev
yes the only error message is at the top saying you hit the 45 min time limit
let's try this. rerun a failed build, and see how long on average does each page generation take
and do it for the successful build as well
you can try console.time and console.timeEnd to also log that time duration
Avatar
Cuban CrocodileOP
Hit the limit again in the prod env and in the build logs, we can roughly calculate that in the case of failure, each page takes an average of 26 sec
Image
but in the same prod env (2 days ago), each page took only around 0.5 sec
from this screenshot, we can see the build duration from the past few days
there is a huge diff in duration 🤔 we have also checked the API service and found no issues, no rete limit
Avatar
joulev
when building locally, how much does it take on avg?
Avatar
Cuban CrocodileOP
Let me give it a try, there might be a diff depending on the machine performance
Avatar
Cuban CrocodileOP
each page takes an avg of 0.8 sec locally
Avatar
joulev
ok now that is really strange. can you try making a new vercel project and deploying on there, does that fix it?
if not probably time to contact vercel support
Avatar
Cuban CrocodileOP
yeah, I think it's time to get in touch with vercel, thank your for your help 🫡 🙏
Avatar
Cuban CrocodileOP
Fixed, a slow build and subsequent timeout occurred due to the unexpected suspension of an asyn task