You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(db): support Node.js 18+ for the npm package via WASM SQLite fallback (#1260)
## Why
The npm package required Node.js 22.15+ purely because our
config/cache/auth layer depends on the built-in `node:sqlite` module,
which older runtimes don't ship. That excluded users still on Node 18/20
for no fundamental reason — the CLI's actual SQLite footprint is tiny
(prepare → get/all/run, exec, manual transactions).
A user asked for Node 20 support and proposed `better-sqlite3`. We
pushed back on that: a native addon breaks the single-file bundle,
reintroduces per-platform/per-ABI install flakiness, and violates our
zero-runtime-dependencies rule.
## Approach
Fall back to a pure-WASM driver (`node-sqlite3-wasm`) on Node < 22.15,
selected at runtime behind the existing single-file adapter:
- **22.15+** → native `node:sqlite` (unchanged fast path)
- **18–22.14** → bundled WASM driver
It's a bundled devDependency, so the single-file bundle and
no-runtime-deps guarantees both hold.
Critically, the driver is `require()`d lazily so the standalone binary
build externalizes it: the SEA binary always embeds a modern LTS Node
and uses native `node:sqlite`, making the WASM path dead code there that
adds **zero bytes** to the binary. This was the hard constraint for
taking this route over `better-sqlite3`.
## Tradeoff
The WASM fallback can't use SQLite WAL mode, so its local cache is
slower and less concurrency-friendly. Acceptable for a single-process
CLI, and the docs now steer people toward the standalone binary or Node
22.15+.
## Version floors
Dev tooling still needs 22.15+ (it runs the sources against
`node:sqlite` via tsx). So `engines.node` advertises the consumer floor
(`>=18`) while a new `devEngines` field records the development floor —
the doc generator was decoupled to keep the two independent.
CI now runs the npm-package job on a Node 20 matrix entry so the WASM
fallback is exercised, not just shipped.
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ yarn global add sentry
37
37
bun add -g sentry
38
38
```
39
39
40
-
> The npm/pnpm/yarn packages require Node.js 22.15+.
40
+
> The npm/pnpm/yarn packages require Node.js 18+. On Node.js 22.15+ the CLI uses the built-in `node:sqlite`; on Node.js 18–22.14 it transparently falls back to a bundled WASM SQLite driver.
41
41
42
42
### Run Without Installing
43
43
@@ -83,7 +83,7 @@ Credentials are stored in `~/.sentry/` with restricted permissions (mode 600).
83
83
## Library Usage
84
84
85
85
<!-- GENERATED:START library-prereq -->
86
-
Use Sentry CLI programmatically in Node.js (≥22.15) without spawning a subprocess:
86
+
Use Sentry CLI programmatically in Node.js (≥18.0) without spawning a subprocess:
|**Auth**|`token` option or env vars | Env vars only |
214
-
|**Node.js**| >=22 required | Any version |
214
+
|**Node.js**| >=18 required | Any version |
215
215
216
216
## Requirements
217
217
218
-
-**Node.js >= 22** (required for `node:sqlite`)
218
+
-**Node.js >= 18**. On Node.js 22.15+ the built-in `node:sqlite` module is used; on Node.js 18–22.14 the CLI transparently falls back to a bundled WASM SQLite driver, so no native module or extra install step is required.
219
+
220
+
:::caution
221
+
The WASM SQLite fallback (Node.js 18–22.14) does not support [WAL mode](https://www.sqlite.org/wal.html), so concurrent access from multiple processes is slower and its local cache reads/writes are less efficient. For the best performance and reliability we **strongly recommend** the [standalone binary](/installation/) (which bundles a modern runtime) or running on **Node.js 22.15+** so the native `node:sqlite` driver is used.
0 commit comments