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

(events): Unable to use content based filtering patterns in detailType #30220

Open
scub opened this issue May 15, 2024 · 1 comment · May be fixed by #30222
Open

(events): Unable to use content based filtering patterns in detailType #30220

scub opened this issue May 15, 2024 · 1 comment · May be fixed by #30222
Labels
@aws-cdk/aws-events Related to CloudWatch Events bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@scub
Copy link
Contributor

scub commented May 15, 2024

Describe the bug

When using the L2 construct for EventBridge Rules a type failure occurs when attempting to create an event bridge rule that uses content based filtering patterns. Requiring the use of a trapdoor in order to achieve the desired results.

Expected Behavior

Content based filtering patterns are supported in an events detailType

Current Behavior

Type '{ prefix: string; }' is not assignable to type 'string'

Reproduction Steps

#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { Rule, CfnRule } from 'aws-cdk-lib/aws-events';

const app = new cdk.App();

const stack = new cdk.Stack(app, 'RuleTestStack');

const rule = new Rule(stack, 'Rule', {
  eventPattern: {
    detailType: [{"prefix": "shared_"}]
  }
});

Possible Solution

See #30222

Using a trapdoor does provide a work around

(rule.node.defaultChild as CfnRule).addOverride('Properties.EventPattern.detail-type', [{"prefix": "shared_"}])

Additional Information/Context

No response

CDK CLI Version

2.141.0

Framework Version

No response

Node.js Version

18.18.0

OS

OSX

Language

TypeScript

Language Version

Typescript 5.4.0

Other information

No response

@scub scub added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 15, 2024
@github-actions github-actions bot added the @aws-cdk/aws-events Related to CloudWatch Events label May 15, 2024
@scub scub changed the title (events): detailType lacks support (events): Unable to use content based filtering patterns in detailType May 15, 2024
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 16, 2024
@pahud
Copy link
Contributor

pahud commented May 16, 2024

Thank you for your PR.

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. effort/medium Medium work item – several days of effort p2
Projects
None yet
2 participants