我正在使用SAM,而我的lambda由CloudWatchEvents触发。我正在尝试匹配详细信息中包含“广告系列”的事件,如this example of the documentation。这是我的sam模板中lambda Events属性的代码:
feedPost:
Type: CloudWatchEvent
Properties:
EventBusName: my_bus
Pattern:
source:
- mySource
detail:
campaign:
- exists: true
问题是,在部署时会出现以下错误:
事件模式无效。原因:必须存在匹配模式 是非题。在[来源:(字符串)” { “ source”:[“ mySource”],“ detail”:{“ campaign”:[{“ exists”:“ true”}]}}“”;
显然是将true转换为字符串。我该如何进行这项工作?
了解CloudFormation的问题:https://github.com/awslabs/serverless-application-model/issues/1455
暂时没有解决方法。