-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
(events rule): Event pattern is not valid. Reason: suffix match pattern must be a string #32492
Comments
I'm not able to reproduce the issue in your example, would you be able to provide a complete reproducible code sample? const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');
const eventBus = new EventBus(stack, 'EventBus');
new Rule(stack, 'Rule', {
eventPattern: {
detail: {
matchPrefix: m.prefix('created'),
matchSuffix: m.suffix('created'),
},
},
eventBus,
});
Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', {
'EventPattern': {
'detail': {
matchPrefix: [{ 'prefix': 'created' }],
matchSuffix: [{ 'suffix': 'created' }],
},
},
'State': 'ENABLED',
}); EDIT: I misread your expected result, sorry about that |
Hi @phmello20 , thanks for reaching out. Here is the sample code for reproducing the issue - const eventBus = new events.EventBus(this, 'EventBus');
const searchIndexRule = new events.Rule(this, id, {
eventPattern: {
detail: {
matchPrefix: events.Match.prefix('created'),
matchSuffix: events.Match.suffix('created'),
},
},
eventBus,
enabled: true,
}); and the synthesized template - "EventIssueStackE5385CAB": {
"Type": "AWS::Events::Rule",
"Properties": {
"EventBusName": {
"Ref": "EventBus7B8748AA"
},
"EventPattern": {
"detail": {
"matchPrefix": [
{
"prefix": "created"
}
],
"matchSuffix": [
{
"suffix": "created"
}
]
}
},
"State": "ENABLED"
}, which seems as expected. is there anything being missed in the code ? Would request you to share insights on how this issue could be reproduced. Thanks |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
hey @khushail, thanks for your response, I'll try again and I'll let you know shortly |
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
Match.suffix method seems to be generating an invalid event patter
Here's the example:
Once the code is deployed the result is the following:
prefix works fine and the result is {"prefix": "created"} however, suffix is invalid as the result is {"suffix":["created"]}
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
the event patter should be {"suffix":"created"}
Current Behavior
the event pattern is {"suffix":["created"]}
Reproduction Steps
cdk deploy
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.172.0
Framework Version
No response
Node.js Version
v20.12.2
OS
Mac OS 14.6.1
Language
TypeScript
Language Version
5.6.3
Other information
No response
The text was updated successfully, but these errors were encountered: