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

Commit 40166c4

Browse files
committed
fix(cloudfront, aws-cloudfront, aws-lambda, aws-sqs, domain): update aws retry logic
1 parent bbcaeec commit 40166c4

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
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/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)