NextJS Node Env Deployment Times Out

It appears, that I have the same issue with deployments timing out as many other posts, but with NextJS. I receive this log when I try to deploy:

But the deployment times out after 15 minutes of waiting. I have changed the port to 0.0.0.0 as others have suggested, but no dice. Any thoughts?

Hello! We ddi have an incident this morning, but things should be resolved now and we’re investigating to ensure it doesn’t happen again. You can look at our status page for more updates.

However, I’m not sure that your deployment should have been affected by this- are you able to deploy now?

Thank you so much for your quick reply! I’ll subscribe to the status page for the future.

I just tried another deployment and it appears that the problem still persists.

I’m not entirely sure why it’s doing this, but I think it’s having trouble deploying because it’s trying to deploy to http://localhost:3000 instead of just 0.0.0.0:3000. Is there anything in your app that would be causing it to deploy to localhost specifically?

Not particularly. The help message for the next start -H 0.0.0.0 shows the following:
--hostname, -H Hostname on which to start the application (default: 0.0.0.0)

which would imply that it is making the hostname 0.0.0.0. It’s possible that this is a problem on the Next.js side though. I’ll check on their side and get back to you. Thanks for your help so far.

I found the issue. The CLI command automatically changes the 0.0.0.0 host to localhost here: Fix hostname message in dev/start by chulkilee · Pull Request #20409 · vercel/next.js · GitHub. Trying to see if I can find a workaround! I’ll post the solution once I find it.

1 Like

Excellent, good find! Just let me know if things still seem off after you develop a workaround.

Thanks! Just downgraded my next version to 10.0.5, which does not change 0.0.0.0 to localhost on running yarn start, but still times out unfortunately ): I’ve looked through this community and it doesn’t seem like that many people have had trouble with Next.js so I’m wondering if there’s some dependency issue we may be missing.

Here’s the CLI command that starts the server for reference: next.js/next-start.ts at master · vercel/next.js · GitHub

Hello Alex, did a little more digging! I’m curious to know if we’re properly detecting the port of your service, or if there’s a bug in our systems. Could you try setting an environment variable with key PORT and value 3000 in your service?

I’ll continue looking into this issue if that still doesn’t solve things.

Experiencing the same with next js. Tried setting env var PORT 3000 still doesn’t work.

Got it working by getting the application dockerized and then expose port 3000 of the container to 10000 of the host.