Skip to content

fix(rivetkit): gate node:sqlite behind RIVETKIT_NODE_SQLITE env var#4487

Draft
NathanFlurry wants to merge 1 commit intomainfrom
03-23-fix_rivetkit_gate_node_sqlite_behind_rivetkit_node_sqlite_env_var
Draft

fix(rivetkit): gate node:sqlite behind RIVETKIT_NODE_SQLITE env var#4487
NathanFlurry wants to merge 1 commit intomainfrom
03-23-fix_rivetkit_gate_node_sqlite_behind_rivetkit_node_sqlite_env_var

Conversation

@NathanFlurry
Copy link
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app
Copy link

railway-app bot commented Mar 24, 2026

🚅 Deployed to the rivet-pr-4487 environment in rivet-frontend

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Mar 24, 2026 at 2:07 am
frontend-cloud 😴 Sleeping (View Logs) Web Mar 24, 2026 at 2:07 am
frontend-inspector 😴 Sleeping (View Logs) Web Mar 24, 2026 at 2:03 am
ladle ❌ Build Failed (View Logs) Web Mar 24, 2026 at 1:57 am
kitchen-sink ❌ Build Failed (View Logs) Web Mar 24, 2026 at 1:57 am
mcp-hub ✅ Success (View Logs) Web Mar 24, 2026 at 1:54 am

@claude
Copy link

claude bot commented Mar 24, 2026

PR Review: Gate node:sqlite behind RIVETKIT_NODE_SQLITE env var

The 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.

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