Skip to content

Commit

Permalink
Merge pull request #520 from awslabs/issue-519
Browse files Browse the repository at this point in the history
Fix Issue 519
  • Loading branch information
philcaixeta authored Dec 3, 2021
2 parents 9737f23 + c63c433 commit 4dd0dee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions cloudformation/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ Resources:
Action:
- lambda:CreateFunction
- lambda:GetFunction
- lambda:GetFunctionConfiguration
- lambda:UpdateFunctionCode
- lambda:PublishVersion
Resource: arn:aws:lambda:*:*:*
Expand Down
4 changes: 3 additions & 1 deletion lambdas/cloudfront-security/replicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ exports.handler = async (event, context) => {
Runtime: 'nodejs12.x',
Timeout: 1
}).promise()

await lambdaEdge.waitFor('functionExists', { FunctionName: functionName }).promise()
await lambdaEdge.waitFor('functionActive', { FunctionName: functionName, $waiter: { delay: 2, maxAttempts: 5 } }).promise()
console.log('Publishing initial version')
versionResult = await lambdaEdge.publishVersion({
FunctionName: createResult.FunctionArn
Expand All @@ -75,6 +76,7 @@ exports.handler = async (event, context) => {
FunctionName: functionName,
Publish: true
}).promise()
await lambdaEdge.waitFor('functionUpdated', { FunctionName: functionName }).promise()
}

console.log('Saving to S3')
Expand Down

0 comments on commit 4dd0dee

Please sign in to comment.