Skip to content

fix: envInt returns NaN for non-numeric env vars - #410

Open
fix2015 wants to merge 2 commits into
GLips:mainfrom
fix2015:fix/envint-nan-validation
Open

fix: envInt returns NaN for non-numeric env vars#410
fix2015 wants to merge 2 commits into
GLips:mainfrom
fix2015:fix/envint-nan-validation

Conversation

@fix2015

@fix2015 fix2015 commented Jul 6, 2026

Copy link
Copy Markdown

`envInt` was calling `parseInt(val, 10)` and returning the result directly, but `parseInt("abc", 10)` returns `NaN`. That `NaN` would propagate through the config as a valid number — setting `PORT=abc` would cause the HTTP server to try to listen on port `NaN`, producing a confusing error deep in Node's net module instead of a clear validation message.

Added an `isNaN` check so non-numeric environment variables are skipped and the default value is used instead.

fix2015 added 2 commits July 6, 2026 21:08
parseInt("abc", 10) returns NaN which propagated as a valid number
through the config system — setting PORT=abc would try to listen on
port NaN. added isNaN check so non-numeric values are skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant