NextJS app build not working but shown as build successfully !
hugotessera
PROOP

a year ago

Hello, today we faced a very scary situation that we managed to resolve, but I wanted to share it with you because it might require some adjustments on your end.

We pushed some changes to our production environment (a NextJS app), and the deployment was marked as successful. After checking my production environment, it was down. After checking into the build logs, I noticed that the build only took 2 seconds, when it usually takes about 2 minutes.

Despite the build being marked as successful, our NextJS app failed to run with the following error:
Error: Could not find a production build in the '.next' directory.

After regenerating our yarn.lock, we managed to fix the issue. The tricky part is that Railway showed the build as successful, which triggered the deployment of our app. This ultimately failed, leaving our production environment down for about 20 minutes.

It seems like there should be a way to flag builds as incomplete if critical directories like .next are missing or empty.

4 Replies

hugotessera
PROOP

a year ago

190f9aa2-c8b3-46dd-a046-6fe955ffb230


a year ago

are you using a healthcheck?


hugotessera
PROOP

a year ago

We missed the healthcheck set up for that particular service
Thanks a lot for your reply ! We will add it now


a year ago

sounds good, let me know if it helps!


Loading...