【问题标题】:Amazon States Language Errors亚马逊状态语言错误
【发布时间】:2020-01-14 04:20:02
【问题描述】:

我正在创建一个 AWS 状态机 - 我收到一个错误:

这里也是错误链接的站点:https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html

我已经梳理了我的状态机代码几个小时,但我无法弄清楚它有什么问题。以前,当我遇到错误时,它们会出现在 GUI 中 - 但为此,它只是说有一个错误,没有指示错误来自哪里。

这是我的状态机可视化:

这是我的状态机的代码:

{
   "StartAt":"Pass",
   "States":{
      "Pass":{
         "Type":"Pass",
         "Next":"Transform 1"
      },
      "Send Notification 1":{
         "Type":"Task",
         "Resource":"arn:aws:states:::lambda:invoke",
         "Parameters":{
            "FunctionName":"arn:aws:lambda:us-east-1:432700302163:function:CheckInterviewStatus:$LATEST",
            "Payload":{
               "Input.$":"$"
            }
         },
         "Catch":[
            {
               "ErrorEquals":[
                  "States.ALL"
               ],
               "Next":"CatchAllFallback"
            }
         ],
         "Next":"Interview Completed 1"
      },
      "Send Notification 2":{
         "Type":"Task",
         "Resource":"arn:aws:states:::lambda:invoke",
         "Parameters":{
            "FunctionName":"arn:aws:lambda:us-east-1:432700302163:function:CheckInterviewStatus:$LATEST",
            "Payload":{
               "Input.$":"$.Payload"
            }
         },
         "Catch":[
            {
               "ErrorEquals":[
                  "States.ALL"
               ],
               "Next":"CatchAllFallback"
            }
         ],
         "Next":"Interview Completed 2"
      },
      "CatchAllFallback":{
         "Type":"Pass",
         "Result":"This is a fallback from any error code",
         "End":false
      },
      "Send Notification 3":{
         "Type":"Task",
         "Resource":"arn:aws:states:::lambda:invoke",
         "Parameters":{
            "FunctionName":"arn:aws:lambda:us-east-1:432700302163:function:CheckInterviewStatus:$LATEST",
            "Payload":{
               "Input.$":"$.Payload"
            }
         },
         "Catch":[
            {
               "ErrorEquals":[
                  "States.ALL"
               ],
               "Next":"CatchAllFallback"
            }
         ],
         "Next":"Interview Completed 3"
      },
      "CatchAllFallback":{
         "Type":"Pass",
         "Result":"This is a fallback from any error code",
         "End":false
      },
      "Send Notification 4":{
         "Type":"Task",
         "Resource":"arn:aws:states:::lambda:invoke",
         "Parameters":{
            "FunctionName":"arn:aws:lambda:us-east-1:432700302163:function:CheckInterviewStatus:$LATEST",
            "Payload":{
               "Input.$":"$.Payload"
            }
         },
         "Catch":[
            {
               "ErrorEquals":[
                  "States.ALL"
               ],
               "Next":"CatchAllFallback"
            }
         ],
         "Next":"Interview Completed 4"
      },
      "CatchAllFallback":{
         "Type":"Pass",
         "Result":"This is a fallback from any error code",
         "End":false
      },
      "CatchAllFallback":{
         "Type":"Pass",
         "Result":"This is a fallback from any error code",
         "End":false
      },
      "Interview Completed 1":{
         "Type":"Choice",
         "Choices":[
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":true,
               "Next":"Yes 1"
            },
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":false,
               "Next":"No 1"
            }
         ],
         "Default":"No 1"
      },
      "No 1":{
         "Type":"Pass",
         "Next":"Wait 1"
      },
      "Yes 1":{
         "Type":"Pass",
         "End":true
      },
      "Interview Completed 2":{
         "Type":"Choice",
         "Choices":[
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":true,
               "Next":"Yes 2"
            },
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":false,
               "Next":"No 2"
            }
         ],
         "Default":"No 2"
      },
      "No 2":{
         "Type":"Pass",
         "Next":"Wait 2"
      },
      "Yes 2":{
         "Type":"Pass",
         "End":true
      },
      "Interview Completed 3":{
         "Type":"Choice",
         "Choices":[
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":true,
               "Next":"Yes 3"
            },
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":false,
               "Next":"No 3"
            }
         ],
         "Default":"No 3"
      },
      "No 3":{
         "Type":"Pass",
         "Next":"Wait 3"
      },
      "Yes 3":{
         "Type":"Pass",
         "End":true
      },
      "Interview Completed 4":{
         "Type":"Choice",
         "Choices":[
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":true,
               "Next":"Yes 4"
            },
            {
               "Variable":"$.Payload.completed",
               "BooleanEquals":false,
               "Next":"No 4"
            }
         ],
         "Default":"No 4"
      },
      "No 4":{
         "Type":"Pass",
         "End":true
      },
      "Yes 4":{
         "Type":"Pass",
         "End":true
      },
      "Transform 1":{
         "Type":"Pass",
         "Result":0,
         "Next":"Send Notification 1"
      },
      "Transform 2":{
         "Type":"Pass",
         "Result":2,
         "Next":"Send Notification 2"
      },
      "Transform 3":{
         "Type":"Pass",
         "Result":2,
         "Next":"Send Notification 3"
      },
      "Transform 4":{
         "Type":"Pass",
         "Result":1,
         "Next":"Send Notification 4"
      },
      "Wait 1":{
         "Type":"Wait",
         "Seconds":1,
         "Next":"Transform 2"
      },
      "Wait 2":{
         "Type":"Wait",
         "Seconds":1,
         "Next":"Transform 3"
      },
      "Wait 3":{
         "Type":"Wait",
         "Seconds":1,
         "Next":"Transform 4"
      }
   }
}

指向正确方向的指针会非常有帮助。

【问题讨论】:

    标签: amazon-web-services state-machine aws-step-functions


    【解决方案1】:

    我想通了。

    “CatchAllFallback”:{ “类型”:“通过”, "Result":"这是任何错误代码的后备", “结束”:假 },

    被多次定义 - 这导致了错误。

    【讨论】:

      猜你喜欢
      • 2017-06-03
      • 1970-01-01
      • 2018-06-04
      • 2018-04-25
      • 1970-01-01
      • 1970-01-01
      • 2021-02-06
      • 2013-06-20
      • 2016-12-22
      相关资源
      最近更新 更多