aws-cdk: @aws-cdk/aws-s3: notification lambda function does not handle transient s3 errors well
What is the problem?
A deployment failed for our team using a CDK defined infrastructure package due to a failure in the bucket notification lambda function. After looking at the logs in our account, it appears that it was caused due to missing error handling within the bucket notification lambda function. The line that failed was this one, which is called here.
Error logs:
[ERROR] 2021-10-05T18:18:42.172Z 5948f640-82f4-44de-a218-694408fb7bfb Failed to put bucket notification configuration
put_bucket_notification_configuration(bucket, config)
botocore.exceptions.ClientError: An error occurred (OperationAborted) when calling the PutBucketNotificationConfiguration operation: A conflicting conditional operation is currently in progress against this resource. Please try again.
Reproduction Steps
Have multiple notifications attempt to update the bucket? I am not quite sure!
What did you expect to happen?
The bucket notification succeeds. To do this, adding an error handling + retry method here would be great. For transient errors like this, it seems like having more robust error handling and retrying transient errors would be very beneficial. That way all of the consumers of AWS CDK get a smoother experience here
What actually happened?
The bucket notification failed, causing the stack to get into an UPDATE_ROLLBACK_FAILED state
CDK CLI Version
1.25.0
Framework Version
n/a
Node.js Version
n/a
OS
linux
Language
Python
Language Version
3.8
Other information
List of events:
| Time | Resource | Status | Message |
|---|---|---|---|
| 2021-10-05 11:18:42 UTC-0700 | BucketNotifications8F2E257D | UPDATE_FAILED | Received response status [FAILED] from custom resource. Message returned: Error: An error occurred (OperationAborted) when calling the PutBucketNotificationConfiguration operation: A conflicting conditional operation is currently in progress against this resource. Please try again… See the details in CloudWatch Log Stream: 2021/10/05/[$LATEST]f56d3b94003f4219971717943c98f61c (RequestId: 52f908f9-40b7-4583-b6fe-314e65a991e8) |
| 2021-10-05 11:18:46 UTC-0700 | my-stack-name | UPDATE_ROLLBACK_IN_PROGRESS | The following resource(s) failed to update: [BucketNotifications8F2E257D, …]. |
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 15
- Comments: 15 (9 by maintainers)
Commits related to this issue
- chore(s3-notifications): fix broken integration tests (#19793) related to #16811, there is sometimes an issue when multiple operations are performed on the same bucket. To get around this in the int... — committed to aws/aws-cdk by corymhall 5 years ago
- chore(s3-notifications): fix broken integration tests (#19793) related to #16811, there is sometimes an issue when multiple operations are performed on the same bucket. To get around this in the int... — committed to StevePotter/aws-cdk by corymhall 5 years ago
- fix(s3): add bucket policy dependency to notification resource (#30053) ### Issue Closes #27600. Closes #16811. ### Reason for this change PutBucketPolicy and PutBucketNotification API calls are ... — committed to schmiddy/aws-cdk by yerzhan7 3 years ago
Thank you @otaviomacedo. Is there any kind of guess on SLA for a p1 of this nature?
It would be good to be able to set expectations internally.
Hi team, would you help to have a look on this
small work itemwhich wasted us for quite a long time over the last few months?Proposed fix by adding dependency on Bucket Policy: https://github.com/aws/aws-cdk/pull/30053
For what it’s worth, adding a dependency between the bucket policy and the notifications worked for me.