Skip to content

Conversation

@Abogical
Copy link
Member

@Abogical Abogical commented Jun 30, 2025

Issue #15891

Closes #15891.

Reason for this change

To fix intermittent CreatInvalidation errors and wait errors when attempting to invalidating to invalidating the Cloudfront cache.

Description of changes

  • Modified retry strategy of Cloudfront client to help with intermittent CreateInvalidation errors.

Describe any new or updated permissions being added

No permissions added.

Description of how you validated changes

Ran /packages/@aws-cdk/custom-resource-handlers/test/aws-s3-deployment/bucket-deployment-handler/test.sh successfuly.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 30, 2025 15:47
@github-actions github-actions bot added repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK bug This issue is a bug. p1 labels Jun 30, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 30, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@Abogical
Copy link
Member Author

Abogical commented Jun 30, 2025

Exemption Request.

No test available to test against an intermittent external issue.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jun 30, 2025
@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from a7e3cd5 to 543492b Compare July 15, 2025 15:15
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 15, 2025 15:17

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch 4 times, most recently from a595b05 to 59b04ee Compare July 16, 2025 09:41
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 16, 2025
@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from 59b04ee to 7c697ec Compare August 1, 2025 11:54
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from 7c697ec to 2d88e0d Compare August 1, 2025 14:45
@aws-cdk-automation aws-cdk-automation dismissed their stale review August 1, 2025 14:47

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 2d88e0d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from 2d88e0d to f70a0c3 Compare August 11, 2025 12:19
@alvazjor alvazjor self-assigned this Aug 11, 2025
@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from 0282e98 to 15cef9d Compare August 11, 2025 15:33
- 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
@Abogical Abogical force-pushed the cloudfront-invalidate-retry-mechanism branch from 15cef9d to 88e736f Compare August 11, 2025 15:50
@@ -233,11 +239,11 @@ def cloudfront_invalidate(distribution_id, distribution_paths):
},
'CallerReference': str(uuid4()),
})
# by default, will wait up to 10 minutes
cloudfront.get_waiter('invalidation_completed').wait(
Copy link
Contributor

@alvazjor alvazjor Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we expand this to up to 13 min (instead of the default 10min it has) and then we explain in the PR itself that there is a limitation of lambda running for max 15 min, so the additional time is to allow other processing to complete. Sadly the P1 issue cannot be fully addressed due to this limitation, and since CloudFormation doesnt provide a SLA for when the invalidation will be completed after requesting, we need to keep this check to provide the users back a guarantee that the change they intended to do is either complete (success deployment), or failed to complete in the allowed time. We can potentially also improve the error message if that happens. And we also need to add better documentation to this custom resource explaining that limitation and the restrictions we have at the moment, that prevent us from fully solving the P1 issue

@Abogical Abogical requested a review from alvazjor August 20, 2025 13:25
@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 628425c into main Aug 20, 2025
17 of 18 checks passed
@mergify mergify bot deleted the cloudfront-invalidate-retry-mechanism branch August 20, 2025 16:58
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. p1 pr/needs-maintainer-review This PR needs a review from a Core Team Member pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-s3-deployment - intermittent cloudfront "Waiter InvalidationCompleted failed" error

3 participants