fix(ci): use temp config dir in npm smoke test to prevent WASM SQLite crash - #1282
Merged
Conversation
MathurAditya724
force-pushed
the
fix/ci-smoke-test-auth-leak
branch
from
July 22, 2026 19:02
7225abb to
eb59204
Compare
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5486 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.69% 81.69% —%
==========================================
Files 426 426 —
Lines 29969 29969 —
Branches 19496 19496 —
==========================================
+ Hits 24483 24483 —
- Misses 5486 5486 —
- Partials 2045 2045 —Generated by Codecov Action |
… crash The 'Build npm Package (smoke Node 20)' job fails on main with: Fatal: SQLite3Error: unable to open database file Root cause: the WASM SQLite driver (used on Node 20 since node:sqlite is unavailable before 22.15) cannot open the database file at ~/.sentry/cli.db when the smoke test runs after switching from Node 22 to Node 20. The runner's home directory state from the Node 22 build step may include a ~/.sentry directory with permissions or lock state incompatible with the WASM driver's Node.js VFS layer (which uses fs.openSync/mkdirSync for locking, unlike the native driver). The PR's CI was green because on PR runs, the 'production' environment is not activated (conditional on line 782), so SENTRY_AUTH_TOKEN is empty and the CLI takes a lighter code path that doesn't hit the database as early. On main, the token leaks from the Bundle step into the smoke test step, causing the CLI to initialize telemetry earlier, which triggers database access before the --help fast path can avoid it. Fix: 1. Clear SENTRY_AUTH_TOKEN and SENTRY_TOKEN (already done in first fix) 2. Set SENTRY_CONFIG_DIR to runner.temp/.sentry-smoke so the WASM driver creates a fresh database in a known-writable temp directory, avoiding any state left by the Node 22 build step
MathurAditya724
force-pushed
the
fix/ci-smoke-test-auth-leak
branch
from
July 22, 2026 19:07
eb59204 to
39b845e
Compare
MathurAditya724
enabled auto-merge (squash)
July 22, 2026 19:12
Contributor
|
5 tasks
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
The
Build npm Package (smoke Node 20)job fails on main with:This persisted after #1278 (which cleared auth tokens but didn't fix the root cause).
Root Cause
The WASM SQLite driver (used on Node 20 since
node:sqliteis unavailable before 22.15) cannot open the database file at~/.sentry/cli.dbwhen the smoke test runs after switching from Node 22 to Node 20. The runner's home directory state from the Node 22 build step may include a~/.sentrydirectory with permissions or lock state incompatible with the WASM driver's Node.js VFS layer (which usesfs.openSync/mkdirSyncfor locking, unlike the native driver).Why PRs pass but main fails: On PR runs, the
productionenvironment is not activated (conditional on line 782), soSENTRY_AUTH_TOKENis empty and the CLI takes a lighter code path. On main, the token leaks from the Bundle step, causing earlier database initialization before the--helpfast path can avoid it.Fix
SENTRY_CONFIG_DIRto${{ runner.temp }}/.sentry-smokeso the WASM driver creates a fresh database in a known-writable temp directory, avoiding any state left by the Node 22 build stepThis matches the approach used in test infrastructure (
useTestConfigDir) — isolate the config directory to prevent cross-runtime state interference.