【发布时间】:2019-10-07 00:37:30
【问题描述】:
我正在尝试使用 AWS CloudFormation 和以下模板创建 Alexa 技能。我使用here 和--scope alexa::ask:skills:readwrite 描述的过程生成了一个刷新令牌。但是,当我尝试创建堆栈时,它在 Alexa::ASK::Skill 上失败,并带有神秘的错误消息:
更新技能时出错。原因:找不到资源。
堆栈中的所有其他资源在 AlexaSkill 失败之前已成功创建。 什么可能导致该错误消息?
请注意:我已经尝试过多次,所以这不是一次性 CloudFormation 错误。
编辑:这是在 us-east-1(北弗吉尼亚)地区。
更新:我认为这个问题与技能清单中的 uri lambda 端点有关,因为如果我将 uri 硬编码为一个不存在的函数,我会收到同样的错误。
Parameters:
SkillName:
Type: String
BucketName:
Type: String
AlexaDeveloperClientId:
Type: String
AlexaDeveloperClientSecret:
Type: String
AlexaDeveloperRefreshToken:
Type: String
AlexaDeveloperVendorId:
Type: String
Resources:
AlexaS3ReadRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- alexa-appkit.amazon.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
AlexaSkill:
Type: Alexa::ASK::Skill
Properties:
AuthenticationConfiguration:
ClientId: !Ref AlexaDeveloperClientId
ClientSecret: !Ref AlexaDeveloperClientSecret
RefreshToken: !Ref AlexaDeveloperRefreshToken
SkillPackage:
Overrides:
Manifest:
apis:
custom:
endpoint:
uri: !GetAtt LambdaFunction.Arn
S3Bucket: !Ref BucketName
S3BucketRole: !GetAtt AlexaS3ReadRole.Arn
S3Key: !Sub ${SkillName}_skill_package.zip
VendorId: !Ref AlexaDeveloperVendorId
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: !Ref BucketName
S3Key: !Sub ${SkillName}_lambda_package.zip
FunctionName: !Sub bp_alexa_${SkillName}
Handler: main.lambda_handler
Role: !GetAtt LambdaExecutionRole.Arn
Runtime: python3.7
这是堆栈事件历史记录:
2019-09-24 17:21:53 UTC-0400 bp-alexa-play-fortnite-stack ROLLBACK_COMPLETE - AWS::CloudFormation::Stack
2019-09-24 17:21:52 UTC-0400 LambdaExecutionRole DELETE_COMPLETE - AWS::IAM::Role
2019-09-24 17:21:50 UTC-0400 LambdaExecutionRole DELETE_IN_PROGRESS - AWS::IAM::Role
2019-09-24 17:21:50 UTC-0400 AlexaS3ReadRole DELETE_COMPLETE - AWS::IAM::Role
2019-09-24 17:21:49 UTC-0400 LambdaFunction DELETE_COMPLETE - AWS::Lambda::Function
2019-09-24 17:21:49 UTC-0400 LambdaFunction DELETE_IN_PROGRESS - AWS::Lambda::Function
2019-09-24 17:21:49 UTC-0400 AlexaS3ReadRole DELETE_IN_PROGRESS - AWS::IAM::Role
2019-09-24 17:21:48 UTC-0400 AlexaSkill DELETE_COMPLETE - Alexa::ASK::Skill
2019-09-24 17:21:46 UTC-0400 AlexaSkill DELETE_IN_PROGRESS - Alexa::ASK::Skill
2019-09-24 17:21:45 UTC-0400 bp-alexa-play-fortnite-stack ROLLBACK_IN_PROGRESS The following resource(s) failed to create: [AlexaSkill]. . Rollback requested by user. AWS::CloudFormation::Stack
2019-09-24 17:21:44 UTC-0400 AlexaSkill CREATE_FAILED Error occurred while updating the skill. Cause: Resource not found. Alexa::ASK::Skill
2019-09-24 17:21:32 UTC-0400 AlexaSkill CREATE_IN_PROGRESS Resource creation Initiated Alexa::ASK::Skill
2019-09-24 17:21:29 UTC-0400 AlexaSkill CREATE_IN_PROGRESS - Alexa::ASK::Skill
2019-09-24 17:21:27 UTC-0400 LambdaFunction CREATE_COMPLETE - AWS::Lambda::Function
2019-09-24 17:21:27 UTC-0400 LambdaFunction CREATE_IN_PROGRESS Resource creation Initiated AWS::Lambda::Function
2019-09-24 17:21:26 UTC-0400 LambdaFunction CREATE_IN_PROGRESS - AWS::Lambda::Function
2019-09-24 17:21:23 UTC-0400 LambdaExecutionRole CREATE_COMPLETE - AWS::IAM::Role
2019-09-24 17:21:23 UTC-0400 AlexaS3ReadRole CREATE_COMPLETE - AWS::IAM::Role
2019-09-24 17:20:13 UTC-0400 LambdaExecutionRole CREATE_IN_PROGRESS Resource creation Initiated AWS::IAM::Role
2019-09-24 17:20:12 UTC-0400 LambdaExecutionRole CREATE_IN_PROGRESS - AWS::IAM::Role
2019-09-24 17:20:12 UTC-0400 AlexaS3ReadRole CREATE_IN_PROGRESS Resource creation Initiated AWS::IAM::Role
2019-09-24 17:20:11 UTC-0400 AlexaS3ReadRole CREATE_IN_PROGRESS - AWS::IAM::Role
2019-09-24 17:20:08 UTC-0400 bp-alexa-play-fortnite-stack CREATE_IN_PROGRESS User Initiated AWS::CloudFormation::Stack
【问题讨论】:
-
你在哪个地区运行它?
-
资源
AlexaS3ReadRole中的托管策略 ARN 看起来不正确。是错字吗?arn:aws:iam::aws:policy/AmazonS3FullyAccess应该是arn:aws:iam::aws:policy/AmazonS3FullAccess -
是的,谢谢,它实际上是我一直在使用的 AmazonS3ReadOnlyAccess,我会更新
-
当我遇到这样的错误时,我使用
AWS Console手动创建资源,然后使用现有资源创建CFT并相应地更改CFT。 -
感谢@Asdfg,我只是尝试了这个并遇到了同样的错误。也尝试在清单中硬编码现有 Lambda 函数的 Arn。
标签: amazon-web-services amazon-cloudformation alexa alexa-skills-kit