fix(rivetkit): gate node:sqlite behind RIVETKIT_NODE_SQLITE env var#4487
fix(rivetkit): gate node:sqlite behind RIVETKIT_NODE_SQLITE env var#4487NathanFlurry wants to merge 1 commit intomainfrom
Conversation
|
🚅 Deployed to the rivet-pr-4487 environment in rivet-frontend
|
PR Review: Gate node:sqlite behind RIVETKIT_NODE_SQLITE env varThe core idea is sound. The experimental Node.js node:sqlite module emits a noisy warning that is not user-friendly, so gating it behind an env var and falling back to better-sqlite3 is a reasonable approach. The comment block explaining the intent and future plan is clear and well-written. A few things worth addressing: Misleading error message Lines 187-189 in sqlite-runtime.ts still tell the user to run pnpm add better-sqlite3, but it is now a direct production dependency. If loading fails, the real issue is likely a failed native build (missing compiler or headers), not a missing package. The message should reflect that. Consider optionalDependencies better-sqlite3 is a native addon that must be compiled or have a prebuilt binary available. Making it a hard production dependency means every user, including Bun users who will never need it, is forced to install and compile it. The rivetkit-typescript CLAUDE.md also notes that core drivers must remain SQLite-agnostic. Using optionalDependencies instead of dependencies would be more appropriate because the try/catch around the require already handles load failures gracefully, and it would restore the previous behavior: the lock file shows better-sqlite3 was previously marked optional: true, along with its transitive deps (bindings, prebuild-install, decompress-response, etc.). Node version constraint tightened better-sqlite3@12.8.0 requires node 20.x or 22.x or 23.x or 24.x or 25.x, which is stricter than v11. Worth confirming this aligns with the project minimum Node version. Unrelated lock file changes The lock file includes a vite version change for the rivetkit package (vite@7.3.1 to vite@5.4.21 in one vite-tsconfig-paths snapshot). This looks like a side effect of running pnpm install. Worth confirming whether it is intentional. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: