Investigations · guide
API cannot reach the database
Both services are up and still cannot talk. Compare what each side believes the address is.
Ask
bash
whoseport ask "why can't my API reach postgres"
What WhosePort checks
- The host and port DATABASE_URL points at in the project .env (never the value)
- Database container, published ports and networks
- TCP connect to the configured target and to the real listener
- Recent API logs for connection errors
Typical root cause
A port or host mismatch between DATABASE_URL and the running container, often after the container was recreated.
Proposed fix
- update_runtime_config: the port in DATABASE_URL (approval required, original backed up)
- restart_process on the API with its original command (approval required)
Approval
Every step that changes your machine is a typed action classed by the policy engine. It waits for your approval in the dashboard, which shows the target, risk and expected effect first. A changed .env file is backed up before it is written. See
/docs/policy.Verification
- API port listening
- API health endpoint returns 2xx
- Database port reachable over TCP