Commit d904166
authored
fix(ci): use temp config dir in npm smoke test to prevent WASM SQLite crash (#1282)
## Problem
The `Build npm Package (smoke Node 20)` job fails on **main** with:
```
Fatal: SQLite3Error: unable to open database file
```
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: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).
**Why PRs pass but main fails:** 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. On
main, the token leaks from the Bundle step, causing earlier database
initialization before the `--help` fast path can avoid it.
## Fix
1. **Clear auth tokens** in both smoke test steps (from #1278)
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
This matches the approach used in test infrastructure
(`useTestConfigDir`) — isolate the config directory to prevent
cross-runtime state interference.1 parent b2b1c9c commit d904166
1 file changed
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
829 | 825 | | |
830 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
| 837 | + | |
837 | 838 | | |
838 | 839 | | |
839 | 840 | | |
| |||
0 commit comments