我正在使用SAM,我的lambda是由CloudWatchEvents触发的。我正在尝试匹配详细信息中包含"活动"的事件,如本文档示例所示。这是我的 sam 模板中 lambda 事件属性的代码:
feedPost:
Type: CloudWatchEvent
Properties:
EventBusName: my_bus
Pattern:
source:
- mySource
detail:
campaign:
- exists: true
问题是在部署时,会出现以下错误:
事件模式无效。原因:存在匹配模式必须 要么是真的,要么是假的。在 [来源: (字符串("{ "source":["mySource"],"detail":{"campaign":[{"exist":"true"}]}}";
显然,它正在将真实转化为字符串。我怎样才能做到这一点?
了解CloudFormation的问题:https://github.com/awslabs/serverless-application-model/issues/1455
目前没有可用的解决方法。