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] show deployment errors #2771

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This is the log of notable changes to EAS CLI and related packages.
- Upgrade @expo/multipart-body-parser. ([#2751](https://github.com/expo/eas-cli/pull/2751) by [@wschurman](https://github.com/wschurman))
- Pass env var flag to worker deployments. ([#2763](https://github.com/expo/eas-cli/pull/2763) by [@kadikraman](https://github.com/kadikraman))
- Fix request for switching providers when doing Apple auth. ([#2769](https://github.com/expo/eas-cli/pull/2769) by [@szdziedzic](https://github.com/szdziedzic))
- Show upload error message.

### 🧹 Chores

Expand Down
11 changes: 8 additions & 3 deletions packages/eas-cli/src/worker/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,25 @@ export async function uploadAsync(params: UploadParams): Promise<UploadResult> {
return retry(error);
}

const defaultErrorMessage = `Upload of "${filePath}" failed: ${response.statusText}`;

if (
response.status === 408 ||
response.status === 409 ||
response.status === 429 ||
(response.status >= 500 && response.status <= 599)
) {
const message = `Upload of "${filePath}" failed: ${response.statusText}`;
const text = await response.text().catch(() => null);
return retry(new Error(text ? `${message}\n${text}` : message));
return retry(new Error(text ? `${defaultErrorMessage}\n${text}` : defaultErrorMessage));
} else if (response.status === 403) {
const body = await response.json();
const message = body?.error ?? defaultErrorMessage;
throw new Error(message);
kadikraman marked this conversation as resolved.
Show resolved Hide resolved
} else if (response.status === 413) {
const message = `Upload of "${filePath}" failed: File size exceeded the upload limit`;
throw new Error(message);
} else if (!response.ok) {
throw new Error(`Upload of "${filePath}" failed: ${response.statusText}`);
throw new Error(defaultErrorMessage);
}

return {
Expand Down
Loading