I am trying to add a rule using below code
const rule = new Rule(this, 'rule', {
eventBus: bus,
eventPattern: {
"message_data": {
"type": [{ 'equals-ignore-case': 'customer_' }],
},
},
ruleName: `${stackId}-rule`,
});
my JSON event:
{
"message_data":{
"id": "2779e723-dadc-48fe-9a2b-291874cd4463",
"version": "1.0",
"type": "customer"
}
}
When I trying to deploy. It is failing with error
Object literal may only specify known properties, and 'message_data' does not exist in type 'EventPattern'.
Any inputs? Thankyou.
In a Rule, eventPattern
must adhere to the EventPattern interface. message_data
is not a property of that interface. It's difficult to tell what you're trying to achieve here, but this will likely remediate that specific error.
const rule = new Rule(this, 'rule', {
eventBus: bus,
eventPattern: {
detail: {
"message_data": {
"type": [{ 'equals-ignore-case': 'customer_' }],
},
},
},
ruleName: `${stackId}-rule`,
});