Skip to content

fix: throw for a connection string number value that is not a number - #1965

Merged
dhensby merged 1 commit into
tediousjs:masterfrom
dhensby:claude/eloquent-hypatia-1d0942
Nov 20, 2026
Merged

dhensby merged 1 commit into
tediousjs:masterfrom
dhensby:claude/eloquent-hypatia-1d0942

Conversation

@dhensby

@dhensby dhensby commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

What this does:

@tediousjs/connection-string reads a number value with parseInt, so a value such as Max Pool Size=abc gave NaN. node-mssql passed the NaN on, and the result depended on the key and the driver:

Key tedious msnodesqlv8
Connection Timeout Connect failed at once: ETIMEOUT Failed to connect to … in NaNms No login timeout
ConnectRetryInterval A retry after a transient error waited 1 ms, not 10 s Not used
Max Pool Size A test connection opened, then Tarn: opt.max must be an integer > 0 Same as tedious
Min Pool Size A test connection opened, then Tarn: opt.min must be an integer >= 0 Same as tedious
Packet Size Connect failed: ESOCKET … The value of "size" is out of range Not used
Request Timeout Used the 15 s default without a warning No query timeout

The parser now throws an error that names the key and the value, for example Invalid value for connection string key "max pool size": "abc" is not a number. parseConnectionString() throws it, and the ConnectionPool constructor throws it or passes it to the callback.

  • The check applies only to the six number keys that the parser uses. The schema's other number keys (Connection Lifetime, ConnectRetryCount, PoolBlockingPeriod) have no effect in node-mssql, so they don't throw.
  • The check applies only to values that parseInt can't read, so Connection Timeout=30s still gives 30 seconds.
  • An empty value still behaves the same as a left-out key.

Note

A connection string that connected before can now throw, for example Request Timeout=abc on tedious, or either timeout on msnodesqlv8. Each of these had a value that the driver couldn't use.

The new unit tests cover each key, an alias, the constructor, an ignored key and a partial value. The tests for invalid values fail before the change and pass after it. Lint and all 376 unit tests pass. I checked the tedious rows in the table against a local Azure SQL Edge. I got the msnodesqlv8 rows from its source, because msnodesqlv8 can't run on my machine.

Related issues:

Pre/Post merge checklist:

  • Changelog is maintained through release notes, per CHANGELOG.txt.

🤖 Generated with Claude Code

The connection string library reads a number value with parseInt, so a
value such as "abc" gave NaN. For Max Pool Size, Min Pool Size, Packet
Size and Connection Timeout, the connect then failed with a misleading
error from tarn, the socket or the connect timer. Request Timeout used
the default without a warning on tedious and had no timeout on
msnodesqlv8. Connection Timeout also had no timeout on msnodesqlv8, and
ConnectRetryInterval retried after 1 ms.

The parser now throws an error that names the key and the value. The
check applies only to the number keys that the parser uses, and only
to values that parseInt cannot read, so "30s" still gives 30. An empty
value still behaves the same as a left-out key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhensby
dhensby marked this pull request as ready for review November 20, 2026 09:05
@dhensby
dhensby merged commit a979f52 into tediousjs:master Nov 20, 2026
91 of 94 checks passed
@dhensby
dhensby deleted the claude/eloquent-hypatia-1d0942 branch November 20, 2026 11:17
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 12.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant