Debug

Web Service Port

Fix public Services that do not listen on the assigned port

A public Service must listen on 0.0.0.0 and the port Blossom supplies in $PORT. Binding only to 127.0.0.1 or hardcoding another port prevents health checks and public routing from reaching the process.

Symptoms

  • the Service remains starting or unhealthy
  • health checks report connection refused
  • the application logs one listening port while the Service expects another
  • the generated or custom Domain does not reach an otherwise successful Build

Diagnose

  1. Check the Service logs for its bind address and port.
  2. Confirm the Service command does not override $PORT.
  3. Open a Container shell with blossom shell if the runtime needs interactive inspection.
  4. Correct the application or Service command, then deploy a new Release.

Framework Examples

Node.js And Express

const port = process.env.PORT || 3000;
app.listen(port, "0.0.0.0");

Ruby And Rails

port ENV.fetch("PORT", 3000)
bind "tcp://0.0.0.0:#{ENV.fetch('PORT', 3000)}"

Python And Flask

import os
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", 5000)))

Changing Domain settings does not fix an incorrect application bind. The Service contract is the stable fix.