Why Retrying a Canceled Fetch Upload Fails and How to Fix It
A retry that immediately cancels again usually stems from reusing one AbortController, since a signal stays aborted after abort() is called and fetch() rejects at once. The recommended fix is to create a new controller inside each upload attempt so that Upload and Retry each get a fresh one. The example also keeps the controller active while the response body is read, and it aborts the remaining transfer on HTTP errors while still reporting the original error. Cancellations surface as AbortError and should be handled separately from genuine failures. The article also warns that a browser abort does not guarantee the server stopped processing, so resending may create duplicates unless the service's idempotency or status-lookup rules are followed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in