You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: a non-integer or out-of-range PORT env var reaches net.listen and crashes b4 start #1063
resolveServePort in packages/cli/src/lib/dev/serve-runtime.ts decides the port b4 start listens on when --port is not given: the PORT env var, else 8000. Its doc comment says an empty or non-numeric PORT is treated as unset and falls back to 8000, in lockstep with the Dockerfile healthcheck's PORT||8000. The implementation only checks Number.isFinite(Number(trimmed)), so every finite number is honoured as it is:
3.5, -1 and 70000 go straight to net.listen, which throws RangeError [ERR_SOCKET_BAD_PORT], so b4 start crashes with an uncaught Node error. 0x50 and 1e3 bind a port the operator never wrote. Meanwhile the sibling flag parser (parsePort in commands/start.ts, fixed for the upper bound in #1047) rejects all of these with Invalid port.
Expected
PORT is honoured only when it is a decimal integer in 0..65535 (digits only, so no sign, no exponent, no hex, no fraction). Any other value is treated as unset and falls back to 8000, exactly as the doc comment already says for a non-numeric value: the env var is a deployment default, and the Dockerfile's PORT||8000 healthcheck is the behaviour to match. An explicit --port keeps winning, including 0.
Activity
cli: a non-integer or out-of-range `PORT` env var reaches `net.listen…