Cant deploy my Nest.js backend

Nothing happens after npm run start.

Build command: npm install && npm run build
Start command: npm run start

Node version: 20.8.1

It shows the server is running but nothing happens after

It looks like your application is listening incorrectly:

  • Hostname: [::1] (or, the IPv6 version of localhost)
  • Port: 3000 (and 10000 earlier in the logs, which is conflicting)

Render web services must be bound to 0.0.0.0 and, by default, to port 10000. While there is automatic detection in place for the port, it looks like it can fail detection. The docs cover port binding.

Testing this out with a simple NestJS application, I can confirm that it looked like it might have been successful from the logs, but the deployment was not yet live. Deployment would hang for minutes on end when using a different hostname or port. I’m not sure if the deployments would have eventually been reported as failed because I ended up pushing new commits to try different bindings before waiting around long enough.

Here’s what I tried:

Binding Live
127.0.0.1:3000 :x:
127.0.0.1:10000 :x:
0.0.0.0:3000 :x:
0.0.0.0:10000 :white_check_mark:

Once I used 0.0.0.0:10000, the application went from cloning to live within 2 minutes.

When bootstrapping your app, pass it to the application’s listen call:

await app.listen(10000, '0.0.0.0');
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.