Skip to content

Commit a7e3cd5

Browse files
committed
fix(s3-deployment): intermittent CreateInvalidation and/or wait errors
- Waiting for cache invalidation is redundant as it doesn't tell you if a cache invalidation fails anyway. Waiting is removed. - Modified retry strategy of cloudfront client to help with intermittent CreateInvalidation errors. Fixes #15891
1 parent 1965014 commit a7e3cd5

File tree

1 file changed

+7
-5
lines changed
  • packages/@aws-cdk/custom-resource-handlers/lib/aws-s3-deployment/bucket-deployment-handler

1 file changed

+7
-5
lines changed

packages/@aws-cdk/custom-resource-handlers/lib/aws-s3-deployment/bucket-deployment-handler/index.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
from zipfile import ZipFile
1212

1313
import boto3
14+
from botocore.config import Config
1415

1516
logger = logging.getLogger()
1617
logger.setLevel(logging.INFO)
1718

18-
cloudfront = boto3.client('cloudfront')
19+
cloudfront = boto3.client('cloudfront', config=Config(
20+
retries = {
21+
'max_attempts': 9,
22+
'mode': 'standard',
23+
}
24+
))
1925
s3 = boto3.client('s3')
2026

2127
CFN_SUCCESS = "SUCCESS"
@@ -233,10 +239,6 @@ def cloudfront_invalidate(distribution_id, distribution_paths):
233239
},
234240
'CallerReference': str(uuid4()),
235241
})
236-
# by default, will wait up to 10 minutes
237-
cloudfront.get_waiter('invalidation_completed').wait(
238-
DistributionId=distribution_id,
239-
Id=invalidation_resp['Invalidation']['Id'])
240242

241243
#---------------------------------------------------------------------------------------------------
242244
# set metadata

0 commit comments

Comments
 (0)