aws-cdk: aws-s3-deployment - intermittent cloudfront "Waiter InvalidationCompleted failed" error
I’ve come across a deployment where cloudfront was invalidated but the lambda timed out with cfn_error: Waiter InvalidationCompleted failed: Max attempts exceeded. ~I suspect a race conditon, and that reversing the order of cloudfront.create_invalidation() and cloudfront.get_waiter() would fix this race condition.~
edit: proposed fix of reversing create_invalidation() and get_waiter() is invalid, see https://github.com/aws/aws-cdk/issues/15891#issuecomment-898413309
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 29
- Comments: 72 (22 by maintainers)
Links to this issue
Commits related to this issue
- Add parameter - dont fail deployment on CFront err Related to: https://github.com/aws/aws-cdk/issues/15891 — committed to msheiny/aws-cdk by deleted user 4 years ago
- Use sleep instead of sleep 180 instead of waiting for invalidation because of https://github.com/aws/aws-cdk/issues/15891 — committed to mdbudnick/personal-website by mdbudnick 3 years ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
- 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. -... — committed to aws/aws-cdk by Abogical a year ago
Started to see this problem when using s3 bucket deployments with CDK
Can we re-open this issue? It’s still a problem with the underlying lambda even if its related to another service. What if we provide an option to not fail the custom resource if the invalidation fails?
There is a global outage in AWS CloudFront, which is currently affecting us.
https://health.aws.amazon.com/health/status
Is it possible to re-open this issue? We’re experiencing this problem as well.
I raised this issue internally with the CloudFront team. I’ll keep you guys updated in this conversation.
It seems there’s currently a problem in AWS cloudfront I get the same timeouts errors
From the CloudFront team:
and
My team are also seeing this error regularly!
Thank you! Pulling my hair out until I found your comment.
This issue got worse for us so this is our solution for now:
Still happening in 2024… Not sure why I’m using Cloudfront at this point…
This is happening us frequently now also
Reopening because additional customers have been impacted by this issue. @naseemkullah are you still running into this issue?
From other customer experiencing the issue
Message returned: Waiter InvalidationCompleted failed: Max attempts exceededcustomer’s code:
Still facing this issue in 2025
@otaviomacedo Did you ever get an update from them? Just ran into this (also once at deploy, once at rollback), and it’s a major PITA.
Also seeing this problem, deployed have been stable then randomly invalidation failed and the CloudFormation stack got stuck in a bad rollback state that I had to manually resolve because the CloudFront invalidation failed after the files were successfully copied into s3. Prior to this, the memory limit we had set was
1024mb so as mentioned above I don’t believe the issue is related to memory, seems a bit random… maybe sometimes CloudFront takes awhile to process invalidations and the CustomCdkBucketDeployment lambda gives up too quickly?Deployed failed around an hour ago for me, seems likely to have been around the same time @prazian must have experienced the issue… which might suggest the issue is actually a service impact issue with CloudFront?
Those validations that started at 1:14 and 1:23 UTC (so now ~35 minutes ago) still have not completed.
I’ve been getting notifications for this issue since 2021, I wouldn’t hold your breath and perhaps implement retry logic.
Somewhere in the last 2 years the devs said this was an issue internal to Cloudfront and they were working with that team on it. That was a long time ago.
Abandon all hope ye who enter here.
We no longer experience this issue after increasing the memory limit of the bucket deployment.
The defalut memory limit is 128. (docs)
We are also experiencing this issue intermittently with our cloudfront invalidations (once every two weeks or so) 😞
In my case, the invalidation kicked off two and both were in progress for a long time and eventually timed out.
it has happened twice in recent days, next time it occurs i will try to confirm this, iirc the first time this happened i checked and I saw the invalidation event had occurred almost immediately yet the waiter did not see that (that’s why i thought it might be a race condition). Will confirm though!
I think the risk involved in this change is quite low. Please submit the PR and I’ll be happy to review it.