You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but it doesn't even get to the middleware I think, because the exception throws before the middleware has a chance to handle it (ECONNREFUSED in my case but I want to handle ECONNRESET because it happens with keep-alive enabled when the server closes the connection).
Do I need to write my own variant of the RetryMiddleware that is also able to catch the promise rejection and retry on that as well?
The text was updated successfully, but these errors were encountered:
I looked at the implementation of RetryMiddleware and it does allow you to retry on rejection as well. Reason it doesn't work for me is because the request method was POST not GET, and it only enables retries for get requests (not sure yet how to enable it for other methods).
After looking through the issues and reading through the ones explaining why you shouldn't retry anything except GET because of idempotency, I believe this is a new use-case for allowing retries on all http verbs... "this" being the type of exception where we know the request never reached the server, e.g. connection reset (ECONNRESET). In that case the method doesn't matter, the request is always retry-able?
Node.js has keep-alive enabled by default in newer versions (20+), and if the client's socket timeout is higher than the server's keep-alive timeout, you easily end up with a connection reset, thus it's not so uncommon anymore.
I tried basically this:
but it doesn't even get to the middleware I think, because the exception throws before the middleware has a chance to handle it (
ECONNREFUSED
in my case but I want to handleECONNRESET
because it happens with keep-alive enabled when the server closes the connection).Do I need to write my own variant of the
RetryMiddleware
that is also able to catch the promise rejection and retry on that as well?The text was updated successfully, but these errors were encountered: