Node.js ECONNREFUSEDWhat ECONNREFUSED means
ECONNREFUSED is a TCP-level error: your connection attempt reached a host, and that host answered with a reset instead of accepting. That distinguishes it from ETIMEDOUT (no answer at all) and ENOTFOUND (DNS never resolved). A machine exists at the IP you dialed, but no process is accepting connections on that port — or a firewall rule is actively rejecting them.
The most useful debugging data is embedded in the message itself: the exact IP and port Node tried. connect ECONNREFUSED 127.0.0.1:5432 during a cloud deploy usually means an environment variable is unset and your code fell back to localhost. connect ECONNREFUSED ::1:3000 is the classic Node 17+ trap: localhost resolved to the IPv6 address ::1, but the server is bound only to 127.0.0.1. Since Node 17, DNS results are no longer reordered to prefer IPv4, so configurations that worked for years started failing.
When a proxy is involved, read the address carefully. If it is your proxy's host and port, the proxy endpoint refused you — wrong port, or a network block between you and it. If it is the target's address, your proxy settings were silently ignored and Node connected directly, which is its own bug to fix.