All guidesMore providers: databases, auth, hosting, email and payments
On this page

Render deploy error

Render

Port scan timeout reached, no open ports detected

By Ohad Krispin, founder of VibeRaven · LinkedIn

"Port scan timeout reached, no open ports detected" means Render did not find an open port on your web service before its scan timed out, so the deploy fails. Render's docs say every web service must bind to a port on host 0.0.0.0, and they recommend the port in the PORT environment variable, which defaults to 10000. A server that listens only on localhost, or that starts listening after slow start-up work, can miss the scan even though it runs fine on your laptop. Bind to 0.0.0.0 and process.env.PORT, keep the start command to one command, and redeploy. If the app is a bot or worker that serves no HTTP, create a background worker instead of a web service.

What the message means, and what Render requires

Render's troubleshooting page defines it: Render failed to detect at least one open port on your service's host before its scan timed out. The web services page sets the rule. Every web service must bind to a port on host 0.0.0.0, and if Render fails to detect a bound port, the deploy fails and the error appears in your logs. The line below is the text people paste into search.

Port scan timeout reached, no open ports detected

How do I bind an Express, Next.js or FastAPI app to the right host and port?

In Express, pass the host and read the port from the environment. Render's FastAPI guide uses uvicorn with --host 0.0.0.0 --port $PORT. For Next.js, the CLI docs say next start listens on hostname 0.0.0.0 by default and reads the port from PORT, so a plain next start works. It breaks when your start script passes -H localhost or a fixed -p, and the Next.js docs add that PORT cannot be set in a .env file, because the HTTP server boots before any other code runs. Set PORT in the Render dashboard instead, or leave it alone and use the default.

// Express
const port = process.env.PORT || 10000;
app.listen(port, '0.0.0.0');

# FastAPI start command
uvicorn main:app --host 0.0.0.0 --port $PORT

# Next.js start command
next start

The bind is right and the deploy still fails

Render's troubleshooting page lists the other causes. Keep the start command simple and defer any non-essential work until after the server starts listening, so a migration or a cache warm-up does not run before the port opens. If the start command already creates a listening server, do not start a second listener in the app code. Use an IPv4 address such as 0.0.0.0: the same page says Render does not support IPv6 addresses. A process that exits right away shows exit code 0, which the page describes as the app exiting early, because services should run until they get a SIGTERM.

Render does not route traffic to new instances until they pass their health checks, and it cancels the deploy if they do not pass within 15 minutes. A service that serves no HTTP at all should be a background worker.

Checklist

How to fix it, then check the fix

  1. 01
    Find where the app sets its host and port, including the scripts in package.json:
    grep -rnE "\.listen\(|--host|--port|-H |localhost|127\.0\.0\.1" --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist .
  2. 02
    Bind to 0.0.0.0 and the PORT variable:
    const port = process.env.PORT || 10000;
    app.listen(port, '0.0.0.0');
  3. 03In the Render dashboard, open the service Settings and read the Start Command. It should be the one command that starts the server. Move other work so it runs after the server is listening.
  4. 04If you set a PORT variable on the service, the server must listen on that value. If you did not, the default is 10000.
  5. 05If the service does not need to receive HTTP traffic, delete it and create a Background Worker with the same repo and start command.
  6. 06Redeploy and read the deploy logs: the deploy goes live once the new instance passes its health check, and the port scan error no longer appears.

Related

Sources

Official docs behind this checklist

FAQ

FAQ for builders before launch

Why does it work locally but fail on Render?

On your laptop you open localhost in a browser on the same machine, so a server bound to localhost works. Render looks for an open port on the service's host, and its docs require the server to bind to 0.0.0.0.

Which port should my app use on Render?

The one in the PORT environment variable. Render says the default value is 10000 for all web services and recommends binding your HTTP server to the port that PORT defines.

Does Next.js need a change to deploy on Render?

Usually not. next start defaults to hostname 0.0.0.0 and reads PORT. Check that your start script does not pass -H localhost or a fixed -p value.