fix(runtime): require Node.js 22.14 so the guard catches the better-sqlite3 segfault - #200
Merged
Merged
Conversation
The startup guard only compared the major version, so Node.js 22.0-22.13
passed the check and then crashed the process with SIGSEGV while loading
better-sqlite3's prebuilt addon. The prebuild needs Node-API v10, which
is only available from Node.js 22.14.
Verified locally with `new Database(':memory:')`:
22.12.0 SIGSEGV, 22.13.1 SIGSEGV, 22.14.0 OK.
Compare major and minor so the guard prints the actionable message
instead of letting the process segfault, and align `engines` and the
README with the real minimum.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
|
@hcsum thanks for this fix! |
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
On Node.js 22.0–22.13 the bot starts, logs a few lines, then dies with a bare
Segmentation fault: 11:The crash is
better-sqlite3's prebuilt addon. macOS crash report:The prebuild is built against Node-API v10, which only ships from Node.js 22.14. On older 22.x,
dlopenfaults inside the N-API registration instead of failing cleanly.getUnsupportedNodeVersionMessage()was meant to catch exactly this before any native addon is imported, but it only parsed the major version, so every 22.x passed the check.Minimal repro:
Verified locally across installed minors:
Change
src/runtime/node-version.ts: compare major and minor against 22.14. Unparseable versions still pass through without blocking startup.tests/runtime/node-version.test.ts: added a case for 22.12.0; minimum-version case is now 22.14.0.package.json:engines.node→>=22.14.README.md: badge and prerequisite line → 22.14+.CI's
node-version: 22already resolves to the latest 22.x, so it is left alone.Verification
On Node 22.14.0:
npm run build,npm run lint,npm run typecheckclean;npm test→ 135 files, 1317 tests passed.🤖 Generated with Claude Code