fix(sidecar/prepare-node): prefer process.execPath; reject shims#11
Merged
Conversation
v0.1.8's release tarball came out to 9.4 MB instead of the expected ~70 MB because prepare-node-binary.mjs bundled an 86 KB stub instead of the real Node binary. The script picked /opt/homebrew/bin/node on the macos-latest runner, which exists but appears to be a small launcher/shim rather than the full binary. Running the bundled sidecar would crash at startup with garbage from that file. Two complementary fixes: 1. Prefer `process.execPath` — the node interpreter actually running this script. It's by definition a real Node binary in the version the build expects. Especially reliable in CI where setup-node@v4 places node in a stable cache path and execPath resolves there. 2. Reject any candidate smaller than 10 MB with a warning. Real Node binaries are at least ~60 MB on macOS; anything in the hundreds of KB range is a shim and would produce a non-functional bundled node. Warn and skip rather than silently shipping garbage. Verified locally: now picks /usr/local/bin/node (process.execPath) and produces a 112.7 MB bundled node. The build would have shipped an 86 KB stub before this patch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
v0.1.8's release tarball came out to 9.4 MB instead of the expected ~70 MB. Looking at the contents:
The bundled Node binary is an 86 KB stub. Running the sidecar would crash immediately when the bash stub tries to `exec` it.
Root cause
`sidecar/scripts/prepare-node-binary.mjs`'s `findSystemNode()` picks the first existing path from a static list: `/opt/homebrew/bin/node` → `/usr/local/bin/node` → `/opt/local/bin/node` → `command -v node`. On macos-latest GitHub runners, `/opt/homebrew/bin/node` exists but is a small launcher/shim, not the real binary. `existsSync()` returned true, `copyFileSync()` happily copied 86 KB.
Fix
Verified locally
```
source: /usr/local/bin/node
target arch: arm64 (rustc triple aarch64-apple-darwin)
prepared bundled node -> .../aos-mail-node-aarch64-apple-darwin (112.7 MB)
```
After merge
I'll move the v0.1.8 tag again. This is the last (we hope) issue blocking a working release.
🤖 Generated with Claude Code