feat(core): surface S3 error details on upload failure#316
Merged
Conversation
Read the XML error body S3 returns on a failed upload and include the Code/Message in the thrown error so users see the actual reason (e.g. "AccessDenied: Request has expired") instead of a bare HTTP status. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
jsfez
approved these changes
Jun 11, 2026
There was a problem hiding this comment.
Pull request overview
Improves upload failure diagnostics in @argos-ci/core by extracting S3’s XML error Code/Message and including them in thrown upload errors, making failures actionable instead of only showing an HTTP status.
Changes:
- Added helpers to read S3 XML error details and build a richer upload error message.
- Updated both presigned PUT and presigned POST upload paths to throw the richer error.
- Added doc comments clarifying behavior of the upload functions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+46
to
+54
| async function createUploadError( | ||
| url: string, | ||
| response: Response, | ||
| ): Promise<Error> { | ||
| const detail = await readS3ErrorMessage(response); | ||
| const status = `${response.status} ${response.statusText}`; | ||
| return new Error( | ||
| `Failed to upload file to ${url}: ${status}${detail ? ` — ${detail}` : ""}`, | ||
| ); |
The upload e2e globs the whole __fixtures__ dir, including a 10MB PNG that is sharp-optimized, hashed, and uploaded to S3 over the network. That work sits right at the previous 15s limit and timed out in CI. Raise it to 30s, consistent with the sibling skip test's 20s budget. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jsfez
approved these changes
Jun 11, 2026
Address review feedback: trim the Code/Message inner text (pretty-printed XML leaves surrounding whitespace) and only append response.statusText when present, since it's often empty in Node and would yield "403 ". Co-Authored-By: Claude Opus 4.8 (1M context) <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
When an upload to S3 fails, the user previously only saw a bare HTTP status (e.g.
403 Forbidden). S3 returns the real reason in an XML error body:This PR reads that body and includes the
Code/Messagein the thrown error, so failures now read like:Changes
readS3ErrorMessageto extract<Code>/<Message>from the S3 error body (defensive: falls back to whichever field is present, returnsnullon unreadable/non-S3 bodies).createUploadErrorto combine the HTTP status with that detail.uploadFileanduploadFileWithPresignedPostnow throw via this helper.Notes
The error body is parsed with a non-greedy regex rather than a full XML parser, to avoid a dependency for S3's flat, well-known error shape.
🤖 Generated with Claude Code