Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit e0cee9c

Browse files
authored
fix: update aws retry logic and fix dependencies (#1306)
1 parent b892c5d commit e0cee9c

File tree

8 files changed

+41
-7
lines changed

8 files changed

+41
-7
lines changed

packages/libs/cloudfront/src/lib/cloudfront.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export type Credentials = {
2929
export default ({
3030
credentials
3131
}: CloudFrontClientFactoryOptions): CloudFrontClient => {
32+
if (AWS?.config) {
33+
AWS.config.update({
34+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
35+
retryDelayOptions: { base: 200 }
36+
});
37+
}
38+
3239
const cloudFront = new AWS.CloudFront({ credentials });
3340

3441
return {

packages/libs/lambda-at-edge/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,8 @@
7575
"node-fetch": "^2.6.1",
7676
"path-to-regexp": "^6.1.0",
7777
"send": "^0.17.1"
78+
},
79+
"peerDependencies": {
80+
"builtin-modules": "^3.2.0"
7881
}
7982
}

packages/libs/lambda-at-edge/yarn.lock

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,13 +1124,8 @@
11241124
picomatch "^2.2.2"
11251125

11261126
"@sls-next/core@link:../core":
1127-
version "3.1.0-alpha.14"
1128-
dependencies:
1129-
"@hapi/accept" "^5.0.1"
1130-
cookie "^0.4.1"
1131-
jsonwebtoken "^8.5.1"
1132-
path-to-regexp "^6.1.0"
1133-
regex-parser "^2.2.10"
1127+
version "0.0.0"
1128+
uid ""
11341129

11351130
"@tsconfig/node10@^1.0.7":
11361131
version "1.0.8"

packages/serverless-components/aws-cloudfront/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"ramda": "^0.27.1"
2222
},
2323
"peerDependencies": {
24+
"@babel/core": "7.14.6",
2425
"@serverless/core": "^1.1.2",
2526
"aws-sdk": "^2.935.0"
2627
},

packages/serverless-components/aws-cloudfront/src/component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ class CloudFront extends Component {
4242
`Starting deployment of CloudFront distribution to the ${inputs.region} region.`
4343
);
4444

45+
if (AWS?.config) {
46+
AWS.config.update({
47+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
48+
retryDelayOptions: { base: 200 }
49+
});
50+
}
51+
4552
const cf = new AWS.CloudFront({
4653
credentials: this.context.credentials.aws,
4754
region: inputs.region

packages/serverless-components/aws-lambda/src/component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ class AwsLambda extends Component {
6262
`Starting deployment of lambda ${config.name} to the ${config.region} region.`
6363
);
6464

65+
if (AWS?.config) {
66+
AWS.config.update({
67+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
68+
retryDelayOptions: { base: 200 }
69+
});
70+
}
71+
6572
const lambda = new AwsSdkLambda({
6673
region: config.region,
6774
credentials: this.context.credentials.aws

packages/serverless-components/aws-sqs/serverless.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ class AwsSqsQueue extends Component {
2424
const config = mergeDeepRight(getDefaults({ defaults }), inputs);
2525
const accountId = await getAccountId(aws);
2626

27+
if (aws && aws.config) {
28+
aws.config.update({
29+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES || "10"),
30+
retryDelayOptions: { base: 200 }
31+
});
32+
}
33+
2734
const arn = getArn({
2835
aws,
2936
accountId,

packages/serverless-components/domain/utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ const HOSTED_ZONE_ID = "Z2FDTNDATAQYW2"; // this is a constant that you can get
99
* - Gets AWS SDK clients to use within this Component
1010
*/
1111
const getClients = (credentials, region = "us-east-1") => {
12+
if (aws && aws.config) {
13+
aws.config.update({
14+
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES || "10"),
15+
retryDelayOptions: { base: 200 }
16+
});
17+
}
18+
1219
const route53 = new aws.Route53({
1320
credentials,
1421
region

0 commit comments

Comments
 (0)