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

fix: update aws retry logic and fix dependencies #1306

Merged
merged 2 commits into from
Jun 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/libs/cloudfront/src/lib/cloudfront.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export type Credentials = {
export default ({
credentials
}: CloudFrontClientFactoryOptions): CloudFrontClient => {
if (AWS?.config) {
AWS.config.update({
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
retryDelayOptions: { base: 200 }
});
}

const cloudFront = new AWS.CloudFront({ credentials });

return {
Expand Down
3 changes: 3 additions & 0 deletions packages/libs/lambda-at-edge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
"node-fetch": "^2.6.1",
"path-to-regexp": "^6.1.0",
"send": "^0.17.1"
},
"peerDependencies": {
"builtin-modules": "^3.2.0"
}
}
9 changes: 2 additions & 7 deletions packages/libs/lambda-at-edge/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1124,13 +1124,8 @@
picomatch "^2.2.2"

"@sls-next/core@link:../core":
version "3.1.0-alpha.14"
dependencies:
"@hapi/accept" "^5.0.1"
cookie "^0.4.1"
jsonwebtoken "^8.5.1"
path-to-regexp "^6.1.0"
regex-parser "^2.2.10"
version "0.0.0"
uid ""

"@tsconfig/node10@^1.0.7":
version "1.0.8"
Expand Down
1 change: 1 addition & 0 deletions packages/serverless-components/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"ramda": "^0.27.1"
},
"peerDependencies": {
"@babel/core": "7.14.6",
"@serverless/core": "^1.1.2",
"aws-sdk": "^2.935.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ class CloudFront extends Component {
`Starting deployment of CloudFront distribution to the ${inputs.region} region.`
);

if (AWS?.config) {
AWS.config.update({
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
retryDelayOptions: { base: 200 }
});
}

const cf = new AWS.CloudFront({
credentials: this.context.credentials.aws,
region: inputs.region
Expand Down
7 changes: 7 additions & 0 deletions packages/serverless-components/aws-lambda/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ class AwsLambda extends Component {
`Starting deployment of lambda ${config.name} to the ${config.region} region.`
);

if (AWS?.config) {
AWS.config.update({
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES ?? "10"),
retryDelayOptions: { base: 200 }
});
}

const lambda = new AwsSdkLambda({
region: config.region,
credentials: this.context.credentials.aws
Expand Down
7 changes: 7 additions & 0 deletions packages/serverless-components/aws-sqs/serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class AwsSqsQueue extends Component {
const config = mergeDeepRight(getDefaults({ defaults }), inputs);
const accountId = await getAccountId(aws);

if (aws && aws.config) {
aws.config.update({
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES || "10"),
retryDelayOptions: { base: 200 }
});
}

const arn = getArn({
aws,
accountId,
Expand Down
7 changes: 7 additions & 0 deletions packages/serverless-components/domain/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const HOSTED_ZONE_ID = "Z2FDTNDATAQYW2"; // this is a constant that you can get
* - Gets AWS SDK clients to use within this Component
*/
const getClients = (credentials, region = "us-east-1") => {
if (aws && aws.config) {
aws.config.update({
maxRetries: parseInt(process.env.SLS_NEXT_MAX_RETRIES || "10"),
retryDelayOptions: { base: 200 }
});
}

const route53 = new aws.Route53({
credentials,
region
Expand Down