sentinelhub-js icon indicating copy to clipboard operation
sentinelhub-js copied to clipboard

Retry network errors

Open guss84 opened this issue 1 year ago • 0 comments

In some cases the /statistics endpoint throws a 502 Bad Gateway or CORS error. This happens when many requests are made one after another. We should retry these requests, but it is currently ignored by shouldRetry because there is no response in the AxiosError in this case. Axios does add code: ERR_NETWORK to the error object, so we should also retry requests when there is no response but the error code is ERR_NETWORK.

Axios error codes can be seen at https://github.com/axios/axios/blob/1472163d373dda71f74e86365ee2f298d922f5db/lib/core/AxiosError.js#L61
axios-retry has the following logic for network errors https://github.com/softonic/axios-retry/blob/v4.5.0/src/index.ts#L95

Logging error in shoudlRetry:
image

guss84 avatar Sep 24 '24 07:09 guss84