【问题标题】:AWS Step Functions, exiting workflow unexpectedly after interating a few timesAWS Step Functions,迭代几次后意外现有工作流程
【发布时间】:2022-01-11 22:24:42
【问题描述】:

我已经附加了在 AWS 上呈现的工作流。基本上,我是从 API Gateway 触发这个状态机的。但是出于测试目的,我将“等待一个小时”步骤设置为仅等待 60 秒。一切似乎都井然有序,可能是因为我是菜鸟。

当它被触发时,它会运行等待的循环,然后重新触发 lambda 5 5 次迭代,然后意外退出。

如果我将超时设置为 3600 秒,它不会重复超过一次。

如果我手动触发状态机,它将运行大约 2 分钟

Express execution is running...

然后给我以下信息

StartSyncExecution call failed.
There was an error calling StartSyncExecution. Refresh the page to try again.

但是,CloudWatch 日志并没有表明任何错误,它只是说“WaitStateEntered”,然后在分配的超时后继续。

这是一个快速的工作流程,这是我当前状态的状态机。双关语。

{
  "Comment": "State machine for repeated notification until duplicate is resolved",
  "StartAt": "accountDuplicationFind Lambda",
  "States": {
    "accountDuplicationFind Lambda": {
      "Type": "Task",
      "TimeoutSeconds": 6200,
      "Resource": "arn:aws:states:::lambda:invoke",
      "OutputPath": "$.Payload",
      "Parameters": {
        "Payload.$": "$",
        "FunctionName": "READACTED"
      },
      "Next": "Duplicates Found?",
      "Comment": "Invoke the accountDuplicationFind.js in the Account Microservice"
    },
    "Duplicates Found?": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.body",
          "StringMatches": "Duplication Notifications Sent",
          "Next": "Wait for an hour",
          "Comment": "If Duplicates have been found move to wait"
        },
        {
          "Variable": "$.body",
          "StringMatches": "No Reported Duplicates",
          "Next": "Success"
        }
      ],
      "Comment": "Either exit or restart the process according to whether there are dups or not "
    },
    "Wait for an hour": {
      "Type": "Wait",
      "Seconds": 60,
      "Next": "accountDuplicationFind Lambda",
      "Comment": "Wait for 1 hour to notify again"
    },
    "Success": {
      "Type": "Succeed"
    }
  }
}

【问题讨论】:

  • 调试建议:将您的 Sfn 定义复制到 StandardWorkflow 中。您可以直接在控制台中查看分步执行进度(计时、输入、输出、异常)。出于这个原因,我在 Standard 中开发并在 Express 中部署。另一个提示:如果 Rule1 或 Rule2 都不匹配,请考虑在 Choice State 中使用 Default 分支以防止死锁。
  • 谢谢!我能够将工作流程改进为 Standard 而不是 Express,还确保注意将我的选择之一设为默认值,并且它按预期工作!

标签: node.js aws-lambda aws-step-functions aws-state-machine


【解决方案1】:

我将 Step Function 改进为标准工作流程,而不是快速工作流程,这似乎解决了我的问题!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-18
    • 2021-11-15
    • 1970-01-01
    • 2018-08-28
    • 2020-09-05
    相关资源
    最近更新 更多