diff --git a/CHANGELOG.md b/CHANGELOG.md index 87286a156b..dddf7c0b4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐Ÿ› Bug fixes +- Show `eas deploy` upload error messages. ([#2771](https://github.com/expo/eas-cli/pull/2771) by [@kadikraman](https://github.com/kadikraman)) + ### ๐Ÿงน Chores ## [14.2.0](https://github.com/expo/eas-cli/releases/tag/v14.2.0) - 2024-12-13 diff --git a/packages/eas-cli/src/worker/upload.ts b/packages/eas-cli/src/worker/upload.ts index 03f1177458..25e0f93312 100644 --- a/packages/eas-cli/src/worker/upload.ts +++ b/packages/eas-cli/src/worker/upload.ts @@ -109,20 +109,21 @@ export async function uploadAsync(params: UploadParams): Promise { return retry(error); } + const body = await response.json().catch(() => null); + const errorMessage = body?.error ?? `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(errorMessage)); } 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(errorMessage); } return {