DEV Community

David
David

Posted on

Resolving the Lambda S3 Trigger Error

While setting up a Lambda function to process S3 logs, I encountered an error that wasn't immediately obvious how to resolve:

Your Lambda function "[function-name]" was successfully created, but an error occurred when creating the trigger: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.

The error appeared when trying to set up the trigger through the AWS Console. My use case was straightforward - I needed to process logs as they arrived in an S3 bucket. The Lambda function was created successfully, but the S3 trigger configuration kept failing.

What Didn't Work

Initially, I tried:

  1. Deleting and recreating the trigger through the AWS Console
  2. Double-checking the event types and prefix/suffix settings
  3. Verifying IAM permissions were correct

None of these steps resolved the issue, and the error message wasn't particularly helpful in pointing to the real problem.

Finding the Actual Issue

The breakthrough came when I decided to inspect the bucket's configuration using the AWS CLI:

aws s3api get-bucket-notification-configuration --bucket "my-bucket"
Enter fullscreen mode Exit fullscreen mode

This revealed something interesting - a lingering configuration that wasn't visible in the AWS Console:

$ aws s3api get-bucket-notification-configuration --bucket "my-bucket"
{
    "LambdaFunctionConfigurations": [
        {
            "Id": "23410cc7-d44d-4d8a-b50d-5c41dcf80ec9",
            "LambdaFunctionArn": "arn:aws:lambda:us-east-1:637423581329:function:ingest_s3logs",
            "Events": [
                "s3:ObjectCreated:*"
            ]
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

The Solution

With this discovery, the fix was simple:

aws s3api put-bucket-notification-configuration --bucket "my-bucket" --notification-configuration '{}'
Enter fullscreen mode Exit fullscreen mode

This command cleared out the hidden configuration, allowing me to successfully create the new trigger for the log processing function.

Lessons Learned

  1. The AWS Console doesn't always show the full picture of your resource configurations
  2. When dealing with S3 event notifications, the CLI can reveal hidden settings
  3. Sometimes starting with a clean slate is the quickest path to resolution

Further Reading

For official documentation and more details about this issue:

Top comments (0)