Skip to content

fix: writable sqlite cache dir (prod EACCES on /build) - #6

Merged
huhn511 merged 1 commit into
mainfrom
fix/builder-data-eacces
Jun 14, 2026
Merged

fix: writable sqlite cache dir (prod EACCES on /build)#6
huhn511 merged 1 commit into
mainfrom
fix/builder-data-eacces

Conversation

@huhn511

@huhn511 huhn511 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Problem

/build → "build something new" 500s in prod with EACCES: permission denied, mkdir './.builder-data'.

The runtime image runs as USER node, but WORKDIR /app is root-owned, so the relative default INDEXER_DATA_DIR (./.builder-data = /app/.builder-data) can't be created by node. Every DB-touching route (creating a project) crashes.

Fix

The sqlite file is a non-authoritative cache (the pod is the source of truth), so a non-writable dir shouldn't take down the app:

  • getDb() catches a failed open and falls back to os.tmpdir()/builder-data with a warning.
  • Dockerfile pre-creates /app/.builder-data owned by node (as root, before the USER switch) and sets INDEXER_DATA_DIR to it — deterministic writable path in prod.

No dev behavior change (still ./.builder-data). tsc --noEmit clean; fallback path verified locally.

🤖 Generated with Claude Code

The prod image runs as USER node, but WORKDIR /app is root-owned, so the
relative default INDEXER_DATA_DIR (./.builder-data = /app/.builder-data)
can't be created — every DB-touching route (e.g. creating a project from
/build) 500s with `EACCES: permission denied, mkdir './.builder-data'`.

The sqlite file is a non-authoritative convenience cache (the pod is the
source of truth), so don't let a non-writable dir crash the app:
- getDb() now catches a failed open and falls back to os.tmpdir().
- Dockerfile pre-creates /app/.builder-data owned by node (as root, before
  the USER switch) and sets INDEXER_DATA_DIR to it for a deterministic
  writable path in prod.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@huhn511
huhn511 merged commit 84cf29a into main Jun 14, 2026
1 check passed
@huhn511
huhn511 deleted the fix/builder-data-eacces branch June 14, 2026 11:14
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