Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] Fix display of errors when expo-updates CLI command fails #2324

Merged
merged 2 commits into from
Apr 12, 2024

Conversation

wschurman
Copy link
Member

@wschurman wschurman commented Apr 12, 2024

Why

It seems that the error thrown by the expo-updates CLI is a normal JS Error, and due to the way the CLI is called, the JS error doesn't print super well when it is thrown.

How

This PR wraps all stderr output in a new error type that at least shows the full error to the user. Still room for improvement on the expo-updates CLI end to make the stderr cleaner.

edit: expo-updates CLI PR: expo/expo#28188

Test Plan

neas update
...
/Users/wschurman/temp/my-app/node_modules/expo-updates/utils/build/resolveRuntimeVersionAsync.js:24
        throw new Error(`You're currently using the bare workflow, where runtime version policies are not supported. You must set your runtime version manually. For example, define your runtime version as "1.0.0", not {"policy": "appVersion"} in your app config. https://docs.expo.dev/eas-update/runtime-versions`);
              ^

Error: You're currently using the bare workflow, where runtime version policies are not supported. You must set your runtime version manually. For example, define your runtime version as "1.0.0", not {"policy": "appVersion"} in your app config. https://docs.expo.dev/eas-update/runtime-versions
    at resolveRuntimeVersionAsync (/Users/wschurman/temp/my-app/node_modules/expo-updates/utils/build/resolveRuntimeVersionAsync.js:24:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolveRuntimeVersion (/Users/wschurman/temp/my-app/node_modules/expo-updates/cli/build/resolveRuntimeVersion.js:63:32)

Node.js v18.18.2

    Error: update command failed.

Copy link

github-actions bot commented Apr 12, 2024

Size Change: +402 B (0%)

Total Size: 51.4 MB

Filename Size Change
./packages/eas-cli/dist/eas-linux-x64.tar.gz 51.4 MB +402 B (0%)

compressed-size-action

Copy link

codecov bot commented Apr 12, 2024

Codecov Report

Attention: Patch coverage is 6.66667% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 53.67%. Comparing base (c29018d) to head (351deeb).
Report is 1 commits behind head on main.

Files Patch % Lines
packages/eas-cli/src/utils/expoUpdatesCli.ts 14.29% 6 Missing ⚠️
packages/eas-cli/src/project/publish.ts 0.00% 4 Missing ⚠️
.../eas-cli/src/project/resolveRuntimeVersionAsync.ts 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2324      +/-   ##
==========================================
- Coverage   53.68%   53.67%   -0.01%     
==========================================
  Files         525      525              
  Lines       19190    19196       +6     
  Branches     4054     4056       +2     
==========================================
+ Hits        10301    10302       +1     
- Misses       8162     8169       +7     
+ Partials      727      725       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -24,13 +25,18 @@ export async function expoUpdatesCommandAsync(projectDir: string, args: string[]
}

try {
return (await spawnAsync(expoUpdatesCli, args)).stdout;
return (await spawnAsync(expoUpdatesCli, args, { stdio: 'pipe' })).stdout;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This technically is not required here, because this spawn should default to pipe, right? Asking to confirm.

We're not using the turtle-spawn here that defaults to inherit:
https://github.com/expo/eas-build/blob/997d6e65c7fea16184d038fdf831352346c1685d/packages/turtle-spawn/src/index.ts#L16-L19

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. I added it just to keep the code reasonably consistent between this and build-tools.

@wschurman
Copy link
Member Author

/changelog-entry bug-fix Fix display of errors when expo-updates CLI command fails

@wschurman wschurman merged commit d05142f into main Apr 12, 2024
5 checks passed
@wschurman wschurman deleted the @wschurman/better-expo-updates-cli-errors branch April 12, 2024 20:36
Copy link

✅ Thank you for adding the changelog entry!

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.

2 participants