Skip to content

fix(uploads): report upload failures instead of reporting success#475

Merged
stakach merged 1 commit into
developfrom
fix/upload-failure-reporting
Jul 25, 2026
Merged

fix(uploads): report upload failures instead of reporting success#475
stakach merged 1 commit into
developfrom
fix/upload-failure-reporting

Conversation

@stakach

@stakach stakach commented Jul 25, 2026

Copy link
Copy Markdown
Member

Uploads that failed could be reported as successful, leaving signage media records pointing at uploads that were never committed. There were two independent causes, and fixing either alone would have left a partial fix:

  • @placeos/cloud-uploads never checked the commit response, so a rejected commit still reported COMPLETED. Fixed in 1.1.2 and picked up here.
  • addMedia resolved as soon as progress reached 100, which happens before finalisation and the commit run, so a failure afterwards was never seen. It now waits for the upload to actually complete.

Credentials:

  • send the API key in its own header when the session uses one. token() returns the literal string "x-api-key" in that mode, which is not a usable bearer token, so every upload from an API key session was rejected.

Retries:

  • retry a failed upload three times, re-validating credentials between attempts, up from exactly once
  • retry the media create on 5xx, 408, 429 and transport failures with backoff. 401 is deliberately left to the API client, which already invalidates the token, re-authorises and replays the request.

Reporting:

  • surface the reason an upload failed rather than a generic "Error"
  • reject with a real Error, and distinguish a cancelled permissions dialog from a genuine failure
  • handle upload rejections in the image, image list and rich text fields, which previously had none and would surface as unhandled rejections

Media library:

  • build the list from the create response instead of a delayed refetch that lost the new item whenever the backend index lagged the write, which itself read as a failed upload

Uploads that failed could be reported as successful, leaving signage media
records pointing at uploads that were never committed. There were two
independent causes, and fixing either alone would have left a partial fix:

- @placeos/cloud-uploads never checked the commit response, so a rejected
  commit still reported COMPLETED. Fixed in 1.1.2 and picked up here.
- addMedia resolved as soon as progress reached 100, which happens before
  finalisation and the commit run, so a failure afterwards was never seen.
  It now waits for the upload to actually complete.

Credentials:

- send the API key in its own header when the session uses one. token()
  returns the literal string "x-api-key" in that mode, which is not a usable
  bearer token, so every upload from an API key session was rejected.

Retries:

- retry a failed upload three times, re-validating credentials between
  attempts, up from exactly once
- retry the media create on 5xx, 408, 429 and transport failures with
  backoff. 401 is deliberately left to the API client, which already
  invalidates the token, re-authorises and replays the request.

Reporting:

- surface the reason an upload failed rather than a generic "Error"
- reject with a real Error, and distinguish a cancelled permissions dialog
  from a genuine failure
- handle upload rejections in the image, image list and rich text fields,
  which previously had none and would surface as unhandled rejections

Media library:

- build the list from the create response instead of a delayed refetch that
  lost the new item whenever the backend index lagged the write, which itself
  read as a failed upload

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
frontend-templates Ignored Ignored Jul 25, 2026 3:03am

@stakach
stakach merged commit af24b68 into develop Jul 25, 2026
27 of 39 checks passed
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.

1 participant