Skip to content

Commit

Permalink
merge fix for retry logic
Browse files Browse the repository at this point in the history
  • Loading branch information
austencollins committed Sep 18, 2020
2 parents 9e2c26a + fe9dd0b commit ba5910d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion serverless.component.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: express
version: 1.7.0
version: 1.7.1
author: eahefnawy
org: serverlessinc
description: Deploys a serverless Express.js application onto AWS Lambda and AWS HTTP API.
Expand Down
6 changes: 6 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ const createLambda = async (instance, inputs, clients, retries = 0) => {
);
}
}
// Try again. We often to wait around 3 seconds after the role is created before it can be assumed
await sleep(3000);
return createLambda(instance, inputs, clients, retries);
}

if (
Expand All @@ -351,6 +354,9 @@ const createLambda = async (instance, inputs, clients, retries = 0) => {
'Unable to create the AWS Lambda function which your Express.js app runs on. The reason is "Lambda was unable to configure access to your environment variables because the KMS key is invalid". This is a known issue with AWS Lambda\'s APIs, and there is nothing the Serverless Framework can do to help with it at this time. We suggest trying to remove this instance by running "serverless remove" then redeploying to attempt to get around this.'
);
}
// Retry.
await sleep(3000);
return createLambda(instance, inputs, clients, retries);
}

throw e;
Expand Down

0 comments on commit ba5910d

Please sign in to comment.