Hello all,
I'm currently working on setting up a Lambda function to be triggered by merge events on the dev, release, and main branches of my CodeCommit repository. I've chosen to use CloudWatch (EventBridge) rules for this purpose. However, despite following the setup process as documented, my Lambda function does not seem to be triggered when merges occur into these branches.
Below is the event pattern I'm using in my CloudWatch rule:
{
"source": ["aws.codecommit"],
"detail-type": ["CodeCommit Pull Request State Change"],
"resources": ["arn:aws:codecommit:region:account-id:repository-name"],
detail: {
event: ["pullRequestMerged"],
destinationReference: [
"refs/heads/release",
"refs/heads/main",
"refs/heads/develop",
],
mergeOption: ["FAST_FORWARD_MERGE"],
},
}
I've double-checked the following:
- The ARN for the repository is correct and matches the repository where the merges are occurring.
- The Lambda function has the necessary permissions to be invoked by CloudWatch Events.
- I've manually tested the Lambda function to ensure it works as expected when invoked directly.
- Despite this, merges into dev, release, or main do not trigger the Lambda function.
Here are some additional details that might be relevant:
- The merges are being done through the AWS CodeCommit console and via git command line, both with the same non-triggering result.
- There are no errors in the CloudWatch Logs that indicate a problem with the rule or the Lambda function.
Questions:
- Is the event pattern correctly configured to capture merge events on these specific branches?
- Are there known issues or limitations with CloudWatch Events and CodeCommit integration that I might be overlooking?
- Could there be a delay or configuration setting I'm missing that affects the triggering of the Lambda function?
Any advice, insights, or recommendations on how to troubleshoot and resolve this issue would be greatly appreciated.
Thank you in advance for your help!
This event is working for me. Thanks a lot!