Skip to content

Commit 4dd0dee

Browse files
authored
Merge pull request #520 from awslabs/issue-519
Fix Issue 519
2 parents 9737f23 + c63c433 commit 4dd0dee

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cloudformation/template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,7 @@ Resources:
18321832
Action:
18331833
- lambda:CreateFunction
18341834
- lambda:GetFunction
1835+
- lambda:GetFunctionConfiguration
18351836
- lambda:UpdateFunctionCode
18361837
- lambda:PublishVersion
18371838
Resource: arn:aws:lambda:*:*:*

lambdas/cloudfront-security/replicator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ exports.handler = async (event, context) => {
6363
Runtime: 'nodejs12.x',
6464
Timeout: 1
6565
}).promise()
66-
66+
await lambdaEdge.waitFor('functionExists', { FunctionName: functionName }).promise()
67+
await lambdaEdge.waitFor('functionActive', { FunctionName: functionName, $waiter: { delay: 2, maxAttempts: 5 } }).promise()
6768
console.log('Publishing initial version')
6869
versionResult = await lambdaEdge.publishVersion({
6970
FunctionName: createResult.FunctionArn
@@ -75,6 +76,7 @@ exports.handler = async (event, context) => {
7576
FunctionName: functionName,
7677
Publish: true
7778
}).promise()
79+
await lambdaEdge.waitFor('functionUpdated', { FunctionName: functionName }).promise()
7880
}
7981

8082
console.log('Saving to S3')

0 commit comments

Comments
 (0)