首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何消除无服务器框架错误模板格式错误

如何消除无服务器框架错误模板格式错误
EN

Stack Overflow用户
提问于 2020-12-05 05:26:23
回答 1查看 79关注 0票数 0

测试,学习无服务器框架。我正在尝试使用两个简单的lambda函数部署简单/基本的状态机。无服务器定义如下:

代码语言:javascript
复制
frameworkVersion: '2'

app: state-machine
org: macdrorepo

service: state-machine

plugins:
  - serverless-python-requirements
  - serverless-iam-roles-per-function
  - serverless-step-functions
  - serverless-pseudo-parameters

custom:
  pythonRequirements:
    dockerizePip: non-linux
    slim: true
    zip: true

provider:
  name: aws
  runtime: python3.8
  region: eu-central-1
  stage: ${opt:stage, 'testing'}
  timeout: 30

package:
  individually: true
  exclude:
    - node_modules/**
    - .git/**
    - .venv/**

functions:
  processpurchase:
    module: state-machine
    memorySize: 128
    stages:
      - testing
      - dev
    handler: ProcessPurchase.process_purchase

  processrefund:
    module: state-machine
    memorySize: 128
    stages:
      - testing
      - dev
    handler: ProcessRefund.process_refund

stepFunctions:
  validate: true
  stateMachines:
    TransactionChoiceMachine:
      name: ChoiceMachineTest-${self:provider.stage}
      dependsOn: CustomIamRole
      definition:
        Comment: "Purchase refund choice"
        StartAt: ProcessTransaction
        States:
          ProcessTransaction:
            Type: Choice
            Choices:
              - Variable: "$.TransactionType"
                StringEquals: PURCHASE
                Next: PurchaseState
              - Variable: "$.TransactionType"
                StringEquals: REFUND
                Next: RefundState
          PurchaseState:
            Type: Task
            Resource:
              Fn::GetAtt: [processpurchase, Arn]
            End: true
          RefundState:
            Type: Task
            Resource:
              Fn::GetAtt: [processrefund, Arn]
            End: true

在部署期间,sls说我的状态机定义是ok:State machine "TransactionChoiceMachine" definition is valid

我的环境信息:

代码语言:javascript
复制
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.20.0
     Framework Version:         2.14.0
     Plugin Version:            4.1.2
     SDK Version:               2.3.2
     Components Version:        3.4.3

不幸的是,Setup SLS_DEBUG=*对我帮助不大,因为我不知道js。

在执行无服务器部署命令后,我收到错误消息:

Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [CustomIamRole] in the Resources block of the template

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-10 21:37:38

看起来您在创建状态机时引用了一个名为CustomIamRole的东西,但我在yaml文件中看不到它是如何创建的。创建角色并在创建中使用它,或者删除依赖项部件。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65150973

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档