Re: [whatwg/fetch] New Proposal: Fetch retry (Issue #1838)

jasnell left a comment (whatwg/fetch#1838)

Overall I think this is a fine addition. I'm not sure how much of a priority implementation would be in non-browser runtimes like Node.js, Cloudflare Workers, etc, but I can't see a reason why it would be problematic. I am concerned about options like `retryAfterUnload` which would only carry useful semantics in browsers. I'd much prefer if there were a way to define it such that it was not specific to browsers... but even then there's just simply no use for it in an environment like Workers (for instance). Not harmful but also not useful in any way.

One immediate comment: I really think there needs to at least be a mechanism for reporting that a retry is happening and when, particularly for debugging purposes. Perhaps some way of integrating with the `ProgressEvent` or something similar would be enough.

I'm not convinced that `retryNonIdempotent: true` is something that should be supported at all. It's just too much of a footgun. I'd suggest that only known safe/idempotent methods should ever be retriable and I'd even go so far as to throw if someone tried to use `retryOptions` with other methods. Of course, if something like http3 is used and the error returned by the server specifically indicates that retry is safe then that's a possible path to supporting this safely but even with that it makes me quite uneasy.

The only other comment I'd have here is that the name `retryOptions` is going to be confusing for some users given that it is intended to be used only for transient network errors. Quite a few applications implement retry for application level errors to and I can foresee some confusion with users who would see `retryOptions` and think that it's an approach for application-level errors as well. That confusion could be avoided with a bit of bikeshedding on the name. `networkRetry`, `connectionRetry`, etc might be better to more specifically scope the retry to the intended case.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1838#issuecomment-3078545912
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1838/3078545912@github.com>

Received on Wednesday, 16 July 2025 13:11:02 UTC