Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventPattern: JSON Serialization of detail_type is incorrect #16563

Closed
mickael-caro-sonarsource opened this issue Sep 21, 2021 · 3 comments · Fixed by #16715
Closed

EventPattern: JSON Serialization of detail_type is incorrect #16563

mickael-caro-sonarsource opened this issue Sep 21, 2021 · 3 comments · Fixed by #16715
Assignees
Labels
@aws-cdk/aws-events Related to CloudWatch Events bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@mickael-caro-sonarsource
Copy link

mickael-caro-sonarsource commented Sep 21, 2021

While using the aws_events.EventPattern class, cdk output as JSON, for detail_type renders detailType instead of detail-type, which cause the pattern to not match the real payload received from EventBridge.

Reproduction Steps

Create the following event pattern

    event_pattern = aws_events.EventPattern(
        account=[core.Aws.ACCOUNT_ID],
        detail={
        'Status': ['Failed', 'TimedOut', 'Cancelled']
    },
        region='eu-central-1',
        source=['aws.ssm'],
        detail_type=['EC2 Automation Execution Status-change Notification']
    )

When issuing a CDK synth, the output eventPattern looks like this :

"EventPattern": {
"account": [
{
"Ref": "AWS::AccountId"
}
],
"detail": {
"Status": [
"Failed",
"TimedOut",
"Cancelled"
]
},
"detailType": [
"EC2 Automation Execution Status-change Notification"
],
"region": [
"eu-central-1"
],
"source": [
"aws.ssm"
]
}

What did you expect to happen?

detailType object should be rendered as detail-type instead.

Environment

  • **CDK CLI Version :1.122.0 **
  • **Node.js Version: v14.15.5 **
  • **OS :Ubuntu 18.04 LTS **
  • **Language (Version): Python 3.8.10 **

This is 🐛 Bug Report

@mickael-caro-sonarsource mickael-caro-sonarsource added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 21, 2021
@github-actions github-actions bot added the @aws-cdk/aws-events Related to CloudWatch Events label Sep 21, 2021
@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 29, 2021

Are you using the EventPattern class with a CfnRule by any chance?

@rix0rrr rix0rrr added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 29, 2021
@mickael-caro-sonarsource
Copy link
Author

Hi @rix0rrr yes this is the case.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Oct 1, 2021
@mergify mergify bot closed this as completed in #16715 Oct 4, 2021
mergify bot pushed a commit that referenced this issue Oct 4, 2021
#16715)

Fixes #16563.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Oct 4, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

njlynch pushed a commit that referenced this issue Oct 11, 2021
#16715)

Fixes #16563.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
aws#16715)

Fixes aws#16563.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-events Related to CloudWatch Events bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants