Skip to content

DX-3200: clear error for browser upload outside a browser - #14

Merged
CahidArda merged 5 commits into
mainfrom
DX-3200-browser-env
Oct 27, 2026
Merged

CahidArda merged 5 commits into
mainfrom
DX-3200-browser-env

Conversation

@ytkimirti

@ytkimirti ytkimirti commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

upload() and the upload hooks now throw invalid_input (400) naming Bucket.put when XMLHttpRequest is missing, before any route call, instead of failing after begin as a 503 request_failed.
A headers() throw or non-JSON input is now a 400 and other bugs a 500 instead of 503; any 2xx for end counts as accepted, so a cut-off or malformed answer is a 502 that retry() and resume never re-send.
Docs: upstash/docs#953

@ytkimirti
ytkimirti marked this pull request as ready for review October 23, 2026 08:24

@CahidArda CahidArda left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-sending a cut-off end can delete an accepted upload (high).

routeCall now re-sends a call whose 2xx body was cut off (src/browser/task.ts:583-588). A 2xx for end means onUploadComplete has already returned, and end isn't idempotent on the server:

  • Single PUT: onUploadComplete runs again. If it throws (for example a duplicate key), discard() deletes the object the first call accepted.
  • Multipart: onUploadComplete runs again, so the app gets a duplicate row.

Fix: don't re-send end after a 2xx; throw a "completed, response lost" error instead. Main's existing retries of end on 5xx and network errors have the same problem, so end should also be made idempotent on the server.

Release notes: upload() now throws synchronously outside a browser, and headers() throws now return 400 (other non-BlobErrors 500) instead of 503.

@ytkimirti
ytkimirti force-pushed the DX-3200-browser-env branch from 84e3883 to fddc4e1 Compare October 27, 2026 08:25
@CahidArda
CahidArda merged commit 2f81638 into main Oct 27, 2026
7 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.

2 participants