AWS Step function error : There are Amazon States Language errors in your state machine definition. Fix the errors to continue

AWS Step function error : There are Amazon States Language errors in your state machine definition. Fix the errors to continue

我是 AWS 步骤函数的新手。 尝试创建粘合作业的基本 ETL 流程。状态机定义完成后,我无法看到正在生成的图形,但出现一般错误“您的状态机定义中存在 Amazon States Language 错误。修复错误以继续”, error message 那不允许我继续。

这是代码和图表:

{
  "Comment": "DRC downstream glue jobs execution step function:slf_aws_can_dbisdel_everyone_drc_amp",
  "StartAt": "startFlow",
  "States": {
    "Comment": "various state types of the Amazon States Language",
    "startFlow": {
      "Comment": "Pass states are useful when constructing and debugging state machines.",
      "Type": "Pass",
      "Next": "stg_ods"
    },
    "stg_ods": {
      "Type": "Task",
      "Resource": "arn:aws:states:::glue:startJobRun.sync",
      "Parameters": {
        "JobName": "stage_job_name"
      },
      "Next": "ods_job"
    },
    "ods_job": {
      "Type": "Task",
      "Resource": "arn:aws:states:::glue:startJobRun.sync",
      "Parameters": {
        "JobName": "main_job_name"
      },
      "Next": "Wait 3 sec"
    },    
    "Wait 3 sec": {
      "Comment": "A Wait state delays the state machine from continuing for a specified time.",
      "Type": "Wait",
      "Seconds": 3,
      "Next": "parallel_stg_adr"
    },
    "parallel_stg_adr": {
      "Comment": "A Parallel state can be used to create parallel branches of execution in your state machine.",
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "stg_job1",
          "States": {
            "stg_job1": {
              "Type": "Task",
              "Resource": "arn:aws:states:::glue:startJobRun.sync",
              "Parameters": {
                "JobName": "stg_job_name1"
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "stg_job2",
          "States": {
            "stg_job2": {
              "Type": "Task",
              "Resource": "arn:aws:states:::glue:startJobRun.sync",
              "Parameters": {
                "JobName": "stg_job_name2"
              },
              "End": true
            }
          }
        }
      ],
      "Next": "parallel_adr_job"
    },
    "parallel_adr_job": {
      "Comment": "A Parallel state can be used to create parallel branches of execution in your state machine.",
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "job1",
          "States": {
            "job1": {
              "Type": "Task",
              "Resource": "arn:aws:states:::glue:startJobRun.sync",
              "Parameters": {
                "JobName": "some_glue_job",
                "Arguments": {
                  "--target_table": "some_string_table",
                  "--calendar_key": "some_string"
                }
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "job2",
          "States": {
            "job2": {
              "Type": "Task",
              "Resource": "arn:aws:states:::glue:startJobRun.sync",
              "Parameters": {
                "JobName": "some_glue_job",
                "Arguments": {
                  "--target_table": "some_string_table",
                  "--calendar_key": "some_string"
                }
              },
              "End": true
            }
          }
        }
      ],
      "Next": "end_job"
    },
    "end_job": {
      "Type": "Pass",
      "End": true
    }
  }
}

Step function graph

"Comment": "various state types of the Amazon States Language",

第 5 行的这个似乎不正确。 “州”地图不能有“评论”键。删除它,然后尝试。其余配置看起来正确。

编辑 1

如果 Step Function 的类型是 Express,则“.sync”函数将不起作用。尝试将 ARN 更改为

"Resource": "arn:aws:states:::glue:startJobRun"

并且您应该能够保存您的 Step Function。然后您将不得不弄清楚如何设置不同的 Glue 任务。