Skip to content

fix(docker-bun): strip Node SQLite addon from runtime - #11482

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
TheDemonTuan:fix/bun-runtime-strip-native
Aug 25, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
TheDemonTuan:fix/bun-runtime-strip-native

Conversation

@TheDemonTuan

Copy link
Copy Markdown
Contributor

Summary

  • stop copying the top-level better-sqlite3 package into the Bun runner
  • remove every traced or vendored better-sqlite3 copy after standalone assembly
  • fail the image build if any better_sqlite3.node binary remains
  • add a focused regression test

Root cause

An ARM64 Bun container reached bun:sqlite, then aborted during startup with NAPI FATAL ERROR: Error::New napi_get_last_error_info. Isolated probes against the exact failed image showed only better-sqlite3 reproduced the native abort; keytar, onnxruntime-node, sqlite-vec, tls-client-node, wreq-js, and sharp all imported successfully. A JavaScript try/catch cannot recover from this process-level abort.

This PR is intentionally Bun-only. It does not change Node source compatibility or unrelated deployment/Caddy automation. It complements #11468 and #11470 by ensuring no additional standalone copy can still be loaded after the Bun-native SQLite startup path is selected.

Validation

  • failing before the fix, passing after: node --test tests/unit/build/bun-runtime-native-addon.test.mjs
  • production ARM64 evidence from the fork: final image booted, /healthz passed, and blue/green deployment completed without NAPI FATAL ERROR

⚠️ base-red inherited: #11449

@diegosouzapw
diegosouzapw force-pushed the fix/bun-runtime-strip-native branch from 1513500 to 4e2bb5c Compare August 25, 2026 23:33
@diegosouzapw
diegosouzapw merged commit 7b7196f into diegosouzapw:release/v3.8.51 Aug 25, 2026
4 of 7 checks passed
diegosouzapw pushed a commit that referenced this pull request Aug 25, 2026
…e Webpack fallback (#11471)

Validated in a combined 4-PR batch worktree off release/v3.8.51 tip (last of the Bun-native cluster; conflicted against the already-merged #11482's Dockerfile.bun hunk in the shared worktree — resolved by taking this PR's configurable ARG/ENV shape, which is exactly what it's designed to replace, and pushed the same resolution to this branch).
- Focused test: resolve-next-build-bundler-flag.test.mjs — 3/3 pass, part of batch's 5/5 node:test run
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK
- Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff

Thanks for validating with both node --test and bun test — good practice given the dual-runtime surface this touches.
diegosouzapw pushed a commit that referenced this pull request Aug 26, 2026
…11428)

Validated in a combined dependabot worktree off release/v3.8.51 tip alongside #11426 and #11440 — a fresh npm install of all three combined (2437 packages, 0 vulnerabilities) plus full-suite validation:
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity, check:cycles — all OK, including through the @types/node 22→26 major jump
- npm run lint — 0 errors (after also draining an unrelated stale-suppressions cascade, see #11596)
- npm run test:vitest — 451/452 pass; the 1 failure (auto/glm materialization) is a pre-existing timing-flaky test, reproduced 11/11 pass ×3 in isolation, unrelated to this bump
- Node runtime unaffected — v24.16.0 unchanged, only the type definitions moved

8 development-group updates. The bun 1.3.14→1.4.0 + @types/bun bump aligns with the Bun-native infrastructure work merged earlier today (#11468/#11470/#11471/#11482), which was built against Bun 1.4+ assumptions.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…1482)

Validated in a combined 4-PR batch worktree off release/v3.8.51 tip (complements diegosouzapw#11468 and diegosouzapw#11470, both merged first). Conflicted against diegosouzapw#11470's Dockerfile.bun hunk in the shared worktree — resolved additively (both the ownership hardening and the addon-stripping RUN block coexist, ordered so the strip runs as root before USER bun) and pushed the same resolution to this branch.
- Focused test: bun-runtime-native-addon.test.mjs — 1/1 pass, part of batch's 5/5 node:test run
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK
- Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff

Thanks for the isolated-probe root-causing (better-sqlite3 specifically, ruling out keytar/onnxruntime-node/sqlite-vec/tls-client-node/wreq-js/sharp) plus the production ARM64 evidence.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…e Webpack fallback (diegosouzapw#11471)

Validated in a combined 4-PR batch worktree off release/v3.8.51 tip (last of the Bun-native cluster; conflicted against the already-merged diegosouzapw#11482's Dockerfile.bun hunk in the shared worktree — resolved by taking this PR's configurable ARG/ENV shape, which is exactly what it's designed to replace, and pushed the same resolution to this branch).
- Focused test: resolve-next-build-bundler-flag.test.mjs — 3/3 pass, part of batch's 5/5 node:test run
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK
- Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff

Thanks for validating with both node --test and bun test — good practice given the dual-runtime surface this touches.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…iegosouzapw#11428)

Validated in a combined dependabot worktree off release/v3.8.51 tip alongside diegosouzapw#11426 and diegosouzapw#11440 — a fresh npm install of all three combined (2437 packages, 0 vulnerabilities) plus full-suite validation:
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity, check:cycles — all OK, including through the @types/node 22→26 major jump
- npm run lint — 0 errors (after also draining an unrelated stale-suppressions cascade, see diegosouzapw#11596)
- npm run test:vitest — 451/452 pass; the 1 failure (auto/glm materialization) is a pre-existing timing-flaky test, reproduced 11/11 pass ×3 in isolation, unrelated to this bump
- Node runtime unaffected — v24.16.0 unchanged, only the type definitions moved

8 development-group updates. The bun 1.3.14→1.4.0 + @types/bun bump aligns with the Bun-native infrastructure work merged earlier today (diegosouzapw#11468/diegosouzapw#11470/diegosouzapw#11471/diegosouzapw#11482), which was built against Bun 1.4+ assumptions.
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.

3 participants