无服务器框架-无法为任务状态生成IAM策略语句



我正在尝试使用无服务器框架来部署一个调用几个lambda的step函数。这是我的无服务器。yml:

org: bizrob
app: flexipod-2-queue
service: flexipod-2-queue

frameworkVersion: "2 || 3"

custom:
region: eu-west-1

provider:
name: aws
runtime: nodejs14.x

plugins:
- serverless-step-functions

functions:
pullSqlSvr:
handler: flexipod-2-queue/pullSqlSvrData.pullSqlSvr
environment:
REGION: ${self:custom.region}
API_VERSION_S3: "2006-03-01"
API_VERSION_SQS: "2012-11-05"
SQS_QUEUE_URL: !Ref "MyQueue"
sendToDataLake:
handler: queue-2-datalake/sendToDataLake.sendBatchToQueue
environment:
REGION: ${self:custom.region}
API_VERSION_S3: "2006-03-01"
API_VERSION_SQS: "2012-11-05"

stepFunctions:
stateMachines:
flexipodFlow:
name: flexipodFlow
definition:
StartAt: pullSqlSvr
States:
pullSqlSvr:
Type: Task
Resource:
Fn::GetAtt:[pullSqlSvr, Arn]
Next: sendToDataLake
sendToDataLake:
Type: Task
Resource:
Fn::GetAtt:[sendToDataLake, Arn]
End: true

resources:
Resources:
MyQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "flexipod"

当我运行无服务器部署时,我看到以下错误:

将flexipod-2队列部署到stage dev(us-east-1,"无服务器管理-2";provider(无法生成IAM策略声明对于任务状态{Type:"Task",资源:"Fn::GetAtt:[pullSqlSvr,Arn]',Next:"sendToDataLake"}无法生成IAM策略声明对于任务状态{Type:"Task",资源:"Fn::GetAtt:[sendToDataLake,Arn]',结束:true}

×Stack flexipod-2-queue-dev部署失败(72秒(环境:win32,节点16.1.0,框架3.0.0,插件6.0.0,SDK 4.3.0凭据:无服务器仪表板,";无服务器管理-2";提供者(https://app.serverless.com/bizrob/apps/flexipod-2-queue/flexipod-2-queue/dev/us-east-1/providers)文档:Docs.serverless.com支持:forum.serverless.com错误:github.com/serverless/serverless/issues

错误:CREATE_FAILED:FlexipodFlow(AWS::StepFunctions::StateMachine(资源处理程序返回消息:";无效的状态机定义:'SCHEMA_VALIDATION_FAILED:值不是处的有效资源ARN/States/pullSqlSvr/Resource,SCHEMA_VALIDATION_FAILED:值不是有效资源ARN,位于/States/sendToDataLake/resource'(服务:AWSStepFunctions;状态代码:400;错误代码:InvalidDefinition

有关于如何解决的建议吗?

这是一个YAML语法问题。Fn::GetAtt:[pullSqlSvr, Arn]被解析为字符串,而不是键值对。在最后一个冒号后添加空格,或使用!GetAtt快捷方式。

Resource:
Fn::GetAtt:[pullSqlSvr, Arn] # string :(
Fn::GetAtt: [pullSqlSvr, Arn] # key-value :)
!GetAtt pullSqlSvr.Arn # alternative shorthand intrinsic function :)

根据我的经验,如果Steps块中的任何键以小写字母开头,serverless-step-functions将无法正确部署。将其更改为看似区分大小写的等价物,如以下内容,并重新部署可能会奏效:

States:
PullSqlSvr:
Type: Task
Resource:
Fn::GetAtt:[pullSqlSvr, Arn]
Next: sendToDataLake
SendToDataLake:
Type: Task
Resource:
Fn::GetAtt:[sendToDataLake, Arn]
End: true

(我刚刚将pullSqlSvrsendToDataLake转换为它们的PascalCase等价物PullSqlSvrSendToDataLake。(

相关内容

  • 没有找到相关文章

最新更新