How can i set retryStrategy in client config #3765
-
I try to set const MAXIMUM_ATTEMPTS = 6;
const customRetryStrategy = new StandardRetryStrategy(async () => MAXIMUM_ATTEMPTS);
const client = new S3Client({
...
requestHandler: this.requestHandler,
maxAttempts: MAXIMUM_ATTEMPTS,
retryStrategy: customRetryStrategy,
}); But I turn off the network theory triggered the request timeout exception, however, it did not. This exception is not in the scope of // https://github.com/aws/aws-sdk-js-v3/blob/main/packages/service-error-classification/src/constants.ts
export var CLOCK_SKEW_ERROR_CODES = [
"AuthFailure",
"InvalidSignatureException",
"RequestExpired",
"RequestInTheFuture",
"RequestTimeTooSkewed",
"SignatureDoesNotMatch",
];
export var THROTTLING_ERROR_CODES = [
"BandwidthLimitExceeded",
"EC2ThrottledException",
"LimitExceededException",
"PriorRequestNotComplete",
"ProvisionedThroughputExceededException",
"RequestLimitExceeded",
"RequestThrottled",
"RequestThrottledException",
"SlowDown",
"ThrottledException",
"Throttling",
"ThrottlingException",
"TooManyRequestsException",
"TransactionInProgressException",
];
export var TRANSIENT_ERROR_CODES = ["AbortError", "TimeoutError", "RequestTimeout", "RequestTimeoutException"];
export var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; As a result, the retry request cannot be initiated. What can I do to initiate a network retry request? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @ZengTianShengZ, thanks for reaching out. If we review the code, which here is a good point to start, we can see that when you pass your custom retry strategy, but using our implementations (StandardRetryStrategy | AdaptiveRetryStrategy), you should consider the following parameters:
For AdaptiveRetryStrategy you could also provide an extra parameter that is options.rateLimiter, which at this time I am not really familiar with, but you are welcome to explore this code, which contains the default implementation for rate limiter. Also here is a piece of documentation that provides you a better explanation about each retry mode we have implemented. If you have any more questions please just let me know. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @ZengTianShengZ, thanks for reaching out. If we review the code, which here is a good point to start, we can see that when you pass your custom retry strategy, but using our implementations (StandardRetryStrategy | AdaptiveRetryStrategy), you should consider the following parameters: