Repository navigation
[eas-cli] Say why reading the app config failed - #4354
LizunovSergey wants to merge 3 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
|
Adding a before/after against the reported scenario, since the unit tests only prove the new code runs — not that it changes what @brentvatne actually saw. Fixture: a project whose Then calling Before, on which is the message from the issue, with the CLI's own output nowhere in it. After, on this branch: Same fixture, same call, both builds produced by |
3f20744 to
3321bc2
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new error wrapping currently drops the underlying error cause/stack and can hide the original spawn error message when stderr is empty, reducing debuggability and actionable context in some failure modes.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Improves EAS CLI’s error reporting when reading the app config via the versioned Expo CLI fails, so users see the underlying reason (especially for missing/incomplete dependencies) instead of only a non-zero exit code.
Changes:
- Wrap the
spawnExpoCommand(['config', '--json', ...])call to surface the child process stderr and optionally add a “missing/incomplete dependencies” hint. - Add Jest coverage for error-message shaping behavior in
getPrivateExpoConfigAsync. - Add a changelog entry documenting the improved error reporting.
File summaries
| File | Description |
|---|---|
| packages/eas-cli/src/project/expoConfig.ts | Wraps Expo CLI config read failures with a richer message derived from stderr + dependency heuristics. |
| packages/eas-cli/src/project/tests/expoConfig.test.ts | Adds tests covering stderr surfacing and dependency-hint conditions. |
| CHANGELOG.md | Documents the user-visible behavior change. |
Review details
Suppressed comments (1)
packages/eas-cli/src/project/expoConfig.ts:102
- If the Expo CLI fails without writing anything to stderr (and node_modules exists), this currently throws a generic message and hides the original spawn error (which at least includes the command + exit code). Consider falling back to the original error.message when stderr is empty so users still have actionable context.
const stderr = typeof error?.stderr === 'string' ? error.stderr.trim() : '';
const parts = ['Failed to read the app config from the Expo CLI.'];
if (stderr) {
parts.push(stderr);
}
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks for the approval. The red The failure is identical on both attempts of run Node 22 and Node 24 pass on the same commit. Only the Node 20.18.3 leg fails, and in
I have deliberately not pushed a merge from |
When the versioned Expo CLI exits non-zero, the rejected spawn carries only "…/node_modules/expo/bin/cli config --json exited with non-zero code: 1". The CLI's own stderr — which holds the actual reason — is dropped, so the caller is left with an exit code and a path. Surface that output, and when it points at unresolved modules, or the project has no node_modules at all, say that the dependencies look incomplete. This is the same treatment `expoUpdatesCommandAsync` already gives the expo-updates CLI.
The rewritten message is what the user needs, but dropping the rejection threw away its stack and the stdout/stderr/status the spawn attached, so a log or a debugger had less to work with than before. Passing the original through the Error `cause` option keeps both, matching how the rest of the CLI rethrows (`environments/variables.ts`, `commandUtils/workflow/inputs.ts`, `project/ios/entitlements.ts`).
667e252 to
f77a41a
Compare
|
eas-cli moved to changesets (#4580), so I reverted the |
Why
Fixes #4213.
Reading the app config shells out to the versioned Expo CLI, and when that exits non-zero the rejected spawn carries only:
The child's stderr holds the actual reason and is thrown away, so the user is left with an exit code and a path. In the reported case the cause was dependencies that were missing or half-installed — the CLI had almost certainly printed
Cannot find module …, and none of it reached the surface.Worth noting where the existing guards stop:
isExpoInstalledalready returnsfalsewhenexpo/bin/clicannot be resolved at all, andspawnExpoCommandalready turns aMODULE_NOT_FOUNDon that resolution into a good message. Neither covers this case, because hereexpo/bin/clidoes resolve — it just fails to run.How
Wrap the
spawnExpoCommandcall and build a message from what the child actually said:Cannot find module/MODULE_NOT_FOUND), or when the project has nonode_modulesdirectory at all — the second covers a CLI that fails before it can print anything useful.This is the same treatment
expoUpdatesCommandAsyncalready gives the expo-updates CLI inutils/expoUpdatesCli.ts, which readse.stderrand rethrows it rather than letting the bare exit code escape.Before:
After:
Test Plan
Four tests added to
src/project/__tests__/expoConfig.test.ts, which previously covered onlycreateOrModifyExpoConfigAsync.Whole package, to check nothing else depended on the old behaviour:
Each new test was checked against a mutant rather than assumed to discriminate:
surfaces the stderr of a failed expo config commandCannot find module/MODULE_NOT_FOUNDcheck removedpoints at the dependencies when the expo config command cannot resolve a modulenode_modulesexistence check invertedpoints at the dependencies when node_modules is absent…anddoes not blame the dependencies…does not blame the dependencies when they are installed and the failure is unrelatedRemoving the
node_modulescheck outright is not expressible: it is the only use ofprojectDir, so the compiler rejects it withTS6133before any test runs.yarn typecheck,yarn lint(0 warnings, 0 errors) andyarn fmt:checkare clean on this branch.One note in the interest of not overclaiming: on the first full-suite run
src/vcs/clients/__tests__/git.test.tsfailed. It passes on a cleanmaintree, passes twice in isolation with this branch applied, and passes on a repeat full run — it does real git work in temp directories and looks parallelism-sensitive, not related to this change.