@aws-lite/client
Advanced tools
Comparing version 0.21.2 to 0.21.3
{ | ||
"name": "@aws-lite/client", | ||
"version": "0.21.2", | ||
"version": "0.21.3", | ||
"description": "A simple, fast, extensible AWS client", | ||
@@ -46,11 +46,11 @@ "homepage": "https://github.com/architect/aws-lite", | ||
"@architect/eslint-config": "^3.0.0", | ||
"@aws-sdk/util-dynamodb": "^3.556.0", | ||
"@smithy/smithy-client": "^2.5.1", | ||
"@aws-sdk/util-dynamodb": "^3.575.0", | ||
"@smithy/smithy-client": "^3.0.0", | ||
"adm-zip": "^0.5.12", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^9.1.1", | ||
"eslint": "^9.2.0", | ||
"fast-xml-parser": "^4.3.6", | ||
"mock-tmp": "^0.0.4", | ||
"nyc": "^15.1.0", | ||
"semver": "^7.6.0", | ||
"semver": "^7.6.2", | ||
"simple-git-hooks": "^2.11.1", | ||
@@ -57,0 +57,0 @@ "tap-arc": "^1.2.2", |
@@ -44,4 +44,5 @@ let aws4 = require('aws4') | ||
catch (error) { | ||
if (i < retries && retryableTimeoutErrorCodes.includes(error?.error?.code)) { | ||
await retryDelay(i, `connection error: ${error.error.code}`, debug) | ||
let retryable = error.error && isRetryableError(error) | ||
if (i < retries && retryable) { | ||
await retryDelay(i, retryable, debug) | ||
} | ||
@@ -202,3 +203,3 @@ else { | ||
catch { | ||
// lolnothingmatters | ||
// lolnothingmatters | ||
payload = body.toString() | ||
@@ -269,11 +270,36 @@ } | ||
let isOk = statusCode => statusCode >= 200 && statusCode < 303 | ||
let reqCompleted = statusCode => statusCode < 500 && statusCode !== 429 /* Throttled */ | ||
// AWS defines transient error status codes as 500, 502, 503, 504, and error codes as below | ||
// The following transient AWS error codes are also designated retryable: [ 'TimeoutError', 'RequestTimeout', 'RequestTimeoutException' ] | ||
// see: smithy-typescript/packages/service-error-classification/src/constants.ts | ||
let reqCompleted = statusCode => statusCode < 500 && statusCode !== 429 /* Throttled */ | ||
const awsTimeoutErrorCodes = [ 'ECONNRESET', 'EPIPE', 'ETIMEDOUT' ] | ||
// See: smithy-typescript/packages/service-error-classification/src/constants.ts | ||
const awsTimeoutErrorCodes = [ 'ECONNREFUSED', 'ECONNRESET', 'EPIPE', 'ETIMEDOUT' ] | ||
const aws4TimeoutErrorCodes = [ 'EADDRINFO', 'ESOCKETTIMEDOUT', 'ENOTFOUND', 'EMFILE' ] | ||
const retryableTimeoutErrorCodes = awsTimeoutErrorCodes.concat(aws4TimeoutErrorCodes) | ||
const clockSkewErrorCodes = [ | ||
'AuthFailure', | ||
'InvalidSignatureException', | ||
'RequestExpired', | ||
'RequestInTheFuture', | ||
'RequestTimeTooSkewed', | ||
'SignatureDoesNotMatch', | ||
] | ||
const throttlingErrorCodes = [ | ||
'BandwidthLimitExceeded', | ||
'EC2ThrottledException', | ||
'LimitExceededException', | ||
'PriorRequestNotComplete', | ||
'ProvisionedThroughputExceededException', | ||
'RequestLimitExceeded', | ||
'RequestThrottled', | ||
'RequestThrottledException', | ||
'SlowDown', | ||
'ThrottledException', | ||
'Throttling', | ||
'ThrottlingException', | ||
'TooManyRequestsException', | ||
'TransactionInProgressException', // DynamoDB | ||
] | ||
const transientErrorCodes = [ 'TimeoutError', 'RequestTimeout', 'RequestTimeoutException' ] | ||
const maxRetryBackoff = 20 * 1000 | ||
@@ -290,1 +316,19 @@ async function retryDelay (i, reason, debug) { | ||
} | ||
function isRetryableError (error) { | ||
let { code, name, __type, type } = error.error | ||
// code is for connection errors only | ||
if (code && retryableTimeoutErrorCodes.includes(code)) { | ||
return `connection error: ${code}` | ||
} | ||
// name + __type are fairly common; type is jic | ||
for (let factor of [ name, __type, type ].filter(Boolean)) { | ||
let bits = String(factor).split('#') | ||
let errorCode = bits[bits.length - 1] | ||
if (clockSkewErrorCodes.includes(errorCode)) return `clock skew error: ${errorCode}` | ||
if (throttlingErrorCodes.includes(errorCode)) return `throttling error: ${errorCode}` | ||
if (transientErrorCodes.includes(errorCode)) return `transient error: ${errorCode}` | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137319
2586