Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No open ports detected on 0.0.0.0 when hosting FastAPI server on Render

Tags:

python

fastapi

I'm trying to deploy a Python FastAPI server as a web service on Render, but I encounter the following error in the logs after deployment:

INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [86] using WatchFiles
==> No open ports detected on 0.0.0.0, continuing to scan...
INFO: Started server process [88]
INFO: Waiting for application startup.
INFO: Application startup complete.

This results in a message stating "no open ports detected". I've tried changing the port to 8000 and several others but can't seem to resolve the issue.

What I've tried: Ensuring the uvicorn.run() method uses 0.0.0.0 as the host to bind to all interfaces:

uvicorn.run(app, host="0.0.0.0", port=8000, log_level="debug")

Setting the port dynamically to use the PORT environment variable provided by Render with a default fallback:

port = int(os.environ.get("PORT", 8000))
uvicorn.run(app, host="0.0.0.0", port=port, log_level="debug")

Additional Information:

The application runs fine locally.
I've checked the Render documentation on web service port binding and followed the guidelines.

Could there be a configuration step I'm missing, or is there something specific about Render's environment that I need to adjust?

like image 277
Varun Singh Avatar asked Oct 12 '25 01:10

Varun Singh


1 Answers

The default value of PORT is 10000 for all Render web services.

Try use start command ti run application

uvicorn main:app --host 0.0.0.0 --port $PORT

Check this links:

  1. Render Deploy a FastAPI App
  2. Render Web Services
like image 147
Dmitri Galkin Avatar answered Oct 14 '25 16:10

Dmitri Galkin