Skip to content

Commit

Permalink
fix for lambda states
Browse files Browse the repository at this point in the history
  • Loading branch information
eahefnawy committed Nov 30, 2021
1 parent ec51b2e commit 17045b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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: 3.0.0
version: 3.0.1
author: eahefnawy
org: serverlessinc
description: Deploys a serverless Express.js application onto AWS Lambda and AWS HTTP API.
Expand Down
14 changes: 11 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,17 @@ const updateLambdaCode = async (instance, inputs, clients) => {
Publish: true,
};
functionCodeParams.ZipFile = await readFile(instance.state.zipPath);
const res = await clients.lambda.updateFunctionCode(functionCodeParams).promise();
instance.state.lambdaArn = res.FunctionArn;
instance.state.lambdaVersion = res.Version;
try {
const res = await clients.lambda.updateFunctionCode(functionCodeParams).promise();
instance.state.lambdaArn = res.FunctionArn;
instance.state.lambdaVersion = res.Version;
} catch (e) {
if (e.code === 'ResourceConflictException') {
await sleep(2000);
return await updateLambdaCode(instance, inputs, clients);
}
throw e;
}
};

/*
Expand Down

0 comments on commit 17045b8

Please sign in to comment.