Skip to content

@aws-cdk/aws-s3: notification lambda function does not handle transient s3 errors well #16811

@roryj-vendia

Description

@roryj-vendia

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, ...].

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-s3Related to Amazon S3bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions