【发布时间】:2020-11-27 04:45:53
【问题描述】:
您好,我正在使用 AWS SAM 部署一个也依赖 1Click 设备的无服务器应用程序,我的模板部署良好,但我必须排除此值:
CallbackOverrides:
onClickCallback:
这是模板文件
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: securitybutton
Globals:
Function:
Timeout: 10
Resources:
SecurityButtonFunction:
Type: AWS::Serverless::Function
Policies:
- AmazonSNSFullAccess
Properties:
CodeUri: src
Handler: index.lambdaHandler,
Runtime: nodejs12.x
MemorySize: 512
Events:
IoTRule:
Type: IoTRule
Properties:
Sql: SELECT * FROM 'iotbutton/*'
#TOPICS
BRSecurityButtonTopic:
Type: AWS::SNS::Topic
#IoT
#project
BRSecurityButtonProject:
Type: "AWS::IoT1Click::Project"
Properties:
ProjectName: "BRSecurityButton"
Description: "BRSecurityButton"
PlacementTemplate:
DefaultAttributes:
SNSTopic: Changeme
Location: Changeme
Theatre: Changeme
DeviceTemplates:
SecuityButtonTemplate:
DeviceType: "button"
CallbackOverrides:
onClickCallback: !GetAtt
- SecurityButtonFunction
- Arn
Outputs:
SecurityButtonFunction:
Description: "Security Button Lambda Function ARN"
Value: !GetAtt SecurityButtonFunction.Arn
这是导致的 cloudFormation 错误:
Lambda 函数 arn:aws:lambda:us-east-1:LALALALALALA:function:securitybutton-prod-SecurityButtonFunction-6OB47JEIU192 无法调用。 (服务:AWSIoT1ClickProjects;状态码:400; 错误代码:无效请求异常;请求编号: f0e94cd5-0310-4dcf-8d4a-a5ee8b102590;代理:空)
关于BRSecurityButtonProject的逻辑ID
任何帮助将不胜感激
【问题讨论】:
-
您能否检查您的 cloudwatch 日志是否有错误(查找名称与您的函数名称匹配的日志组)。也许它会有更多的细节。
-
嘿,cloudwatch 中没有任何内容,因为模板正在尝试部署。此错误来自 Cloudformation 而不是 Lambda 执行本身
-
你是如何进行“部署”的?你没有告诉我们你运行什么命令。它的输出是什么?
-
我正在使用自定义 bitbucket 管道推送 cloudformation 模板,然后 AWS 运行 cloudformation 堆栈
标签: amazon-web-services amazon-cloudformation aws-iot aws-sam