Repository navigation
fix: settle msnodesqlv8 bulk loads when the table lookup fails - #1912
Merged
dhensby merged 1 commit intoOct 13, 2026
Merged
Conversation
dhensby
force-pushed
the
fix/msnodesqlv8-bulk-lookup-error
branch
from
October 5, 2026 08:02
d261eb3 to
0e82a80
Compare
Before loading rows, the msnodesqlv8 driver looks the table up through msnodesqlv8's table manager (after creating it, when create is set). The table manager reports a failed lookup, such as a table in a database that does not exist, as (null, err) rather than error first, and the error was ignored. The callback then threw reading the columns of a null manager, so bulk() never settled, the borrowed connection was never released, and the TypeError surfaced as an unhandled rejection. The lookup error now goes back through the same path as any other bulk failure, which releases the connection and rejects with a RequestError (code EREQUEST). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhensby
force-pushed
the
fix/msnodesqlv8-bulk-lookup-error
branch
from
October 13, 2026 11:32
0e82a80 to
8d80e84
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix uses the established cleanup path and is adequately covered across both drivers.
0 open findings
What changed in this PR
Fixes msnodesqlv8 bulk requests so table lookup failures reject cleanly and release borrowed connections.
Changes:
- Handles
TableMgr.bind()lookup errors through the existing cleanup path. - Adds shared regression coverage for connection release and pool recovery.
- Registers the test for both supported drivers.
| File | Description |
|---|---|
lib/msnodesqlv8/request.js |
Handles the callback’s lookup-error argument. |
test/common/tests.js |
Adds the shared regression test. |
test/msnodesqlv8/msnodesqlv8.js |
Registers msnodesqlv8 coverage. |
test/tedious/tedious.js |
Registers tedious coverage. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
🎉 This PR is included in version 12.7.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Before loading rows, the msnodesqlv8 driver looks the table up through msnodesqlv8's
TableMgr.bind(). Whentable.createis set, it creates the table first and then looks it up. In every msnodesqlv8 line (v2, v3, v4, 5.2.x, 5.5.x),bind()reports a failed lookup ascb(null, err)from inside a promise.catch. For example, withnew sql.Table('nosuchdb.dbo.t')andcreateoff, msnodesqlv8's describe query fails with 208Invalid object name 'nosuchdb.INFORMATION_SCHEMA.COLUMNS'. Withcreateon, the same name fails earlier, at thecreate tablestep (2702).node-mssql ignored the second argument and read
mgr.columnsonnull. That throw happened inside the.catch, so:bulk()never resolved or rejected;close()hangs;TypeError: Cannot read properties of null (reading 'columns')became an unhandled rejection, which is fatal by default on Node 15+.tedious was not affected: it rejects with
EREQUESTand releases the connection.Fix
The
bind()callback now takes(mgr, err)and returnsdone(err)when there is a lookup error.done()is the path every other bulk failure already uses. It releases the connection and rejects with aRequestErrorwith codeEREQUEST. The native error number (208) is kept and the original error stays onoriginalError.Tests
New shared test
bulk load releases the connection when the table lookup fails, registered in thebulk loadblock of both the tedious and msnodesqlv8 suites. It loads intonotexistingdb.dbo.bulk_table_lookupwith create off and asserts that:RequestErrorwith codeEREQUEST;It does not assert the message, because the drivers differ there (see caveats).
Verification:
npm run lintandnpm run test-unitpass.user defined typesfailure (no CLR on the local SQL Edge). The new test passes on both.lib/msnodesqlv8ran over a tedious-backed stand-in for the native module, with each connection given the real msnodesqlv8 JSTableMgrof v2.7.0, v3.1.0, v4.5.0, 5.2.1 and 5.5.0. Only the native binding was stubbed.after allclose()hangs.Caveats
Invalid object name 'notexistingdb.INFORMATION_SCHEMA.COLUMNS'., ODBC prefix kept).AggregateErrorfor bulk loads, and the 208 errors are inprecedingErrors.Found while bringing the two driver suites in line (#1908, #1910).
🤖 Generated with Claude Code