aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.58k stars 4.13k forks source link

Step Functions `Label` property not supported #8842

Closed arielalas closed 3 months ago

arielalas commented 3 months ago

Describe the bug

When running the following command to deploy a Step Function in localstack:

aws cloudformation deploy --stack-name stack1 --template-file output/us-east-1-combined-cft.json --endpoint-url=http://localhost:4566

I get the following error:

CFn resource failed to deploy: qa-7ps-orchestrator (An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: ASLParserException ['line 1:5677, at "Label", mismatched input \'"Label"\' expecting {\'"Comment"\', \'"Type"\', \'"Choices"\', \'"Default"\', \'"Branches"\', \'"SecondsPath"\', \'"Seconds"\', \'"TimestampPath"\', \'"Timestamp"\', \'"TimeoutSeconds"\', \'"TimeoutSecondsPath"\', \'"HeartbeatSeconds"\', \'"HeartbeatSecondsPath"\', \'"ItemProcessor"\', \'"Iterator"\', \'"ItemSelector"\', \'"MaxConcurrencyPath"\', \'"MaxConcurrency"\', \'"Resource"\', \'"InputPath"\', \'"OutputPath"\', \'"ItemsPath"\', \'"ResultPath"\', \'"Result"\', \'"Parameters"\', \'"ResultSelector"\', \'"ItemReader"\', \'"ToleratedFailureCount"\', \'"ToleratedFailureCountPath"\', \'"ToleratedFailurePercentage"\', \'"ToleratedFailurePercentagePath"\', \'"Next"\', \'"End"\', \'"Cause"\', \'"CausePath"\', \'"Error"\', \'"ErrorPath"\', \'"Retry"\', \'"Catch"\'}', 'line 1:6909, at "Label", mismatched input \'"Label"\' expecting {\'"Comment"\', \'"Type"\', \'"Choices"\', \'"Default"\', \'"Branches"\', \'"SecondsPath"\', \'"Seconds"\', \'"TimestampPath"\', \'"Timestamp"\', \'"TimeoutSeconds"\', \'"TimeoutSecondsPath"\', \'"HeartbeatSeconds"\', \'"HeartbeatSecondsPath"\', \'"ItemProcessor"\', \'"Iterator"\', \'"ItemSelector"\', \'"MaxConcurrencyPath"\', \'"MaxConcurrency"\', \'"Resource"\', \'"InputPath"\', \'"OutputPath"\', \'"ItemsPath"\', \'"ResultPath"\', \'"Result"\', \'"Parameters"\', \'"ResultSelector"\', \'"ItemReader"\', \'"ToleratedFailureCount"\', \'"ToleratedFailureCountPath"\', \'"ToleratedFailurePercentage"\', \'"ToleratedFailurePercentagePath"\', \'"Next"\', \'"End"\', \'"Cause"\', \'"CausePath"\', \'"Error"\', \'"ErrorPath"\', \'"Retry"\', \'"Catch"\'}', 'line 1:7953, at "Label", mismatched input \'"Label"\' expecting {\'"Comment"\', \'"Type"\', \'"Choices"\', \'"Default"\', \'"Branches"\', \'"SecondsPath"\', \'"Seconds"\', \'"TimestampPath"\', \'"Timestamp"\', \'"TimeoutSeconds"\', \'"TimeoutSecondsPath"\', \'"HeartbeatSeconds"\', \'"HeartbeatSecondsPath"\', \'"ItemProcessor"\', \'"Iterator"\', \'"ItemSelector"\', \'"MaxConcurrencyPath"\', \'"MaxConcurrency"\', \'"Resource"\', \'"InputPath"\', \'"OutputPath"\', \'"ItemsPath"\', \'"ResultPath"\', \'"Result"\', \'"Parameters"\', \'"ResultSelector"\', \'"ItemReader"\', \'"ToleratedFailureCount"\', \'"ToleratedFailureCountPath"\', \'"ToleratedFailurePercentage"\', \'"ToleratedFailurePercentagePath"\', \'"Next"\', \'"End"\', \'"Cause"\', \'"CausePath"\', \'"Error"\', \'"ErrorPath"\', \'"Retry"\', \'"Catch"\'}'])

Part of my step function CFT definition includes Label as specified in this document

CFT portion including Label:

 "updateStatustoProvisionedForEks": {
              "ItemProcessor": {
                "ProcessorConfig": {
                  "ExecutionType": "STANDARD",
                  "Mode": "DISTRIBUTED"
                },
                "StartAt": "updateTestStatusToProvisionedForEks",
                "States": {
                  "updateTestStatusToProvisionedForEks": {
                    "End": true,
                    "OutputPath": "$.Payload",
                    "Parameters": {
                      "FunctionName": "arn:aws:lambda:${aws_region}:${aws_account}:function:${update_status_lambda_name}",
                      "Payload": {
                        "Execution.$": "$$.Execution.Id",
                        "status": "PROVISIONED",
                        "testId.$": "$.testId"
                      }
                    },
                    "Resource": "arn:aws:states:::lambda:invoke",
                    "Retry": [
                      {
                        "BackoffRate": 2,
                        "ErrorEquals": [
                          "Lambda.ServiceException",
                          "Lambda.AWSLambdaException",
                          "Lambda.SdkClientException",
                          "Lambda.TooManyRequestsException"
                        ],
                        "IntervalSeconds": 1,
                        "MaxAttempts": 3
                      }
                    ],
                    "Type": "Task"
                  }
                }
              },
              "ItemReader": {
                "Parameters": {
                  "Bucket.$": "$$.Execution.Input.bucket",
                  "Key.$": "$$.Execution.Input.key"
                },
                "ReaderConfig": {
                  "InputType": "JSON"
                },
                "Resource": "arn:aws:states:::s3:getObject"
              },
              "Label": "updateStatustoProvisionedForEks",
              "MaxConcurrency": 1000,
              "Next": "Success (1)",
              "Type": "Map"
            }

Expected Behavior

I expect that the CFT deployment do not fail because there is a Label specified in the step function's definition

Current Behavior

CFT deployment fails because there is a Label property in the step function's definition

Reproduction Steps

  1. Bring up localstack container
  2. Save this CFT locally
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "qa-7ps-orchestrator": {
      "Properties": {
        "Definition": {
          "Comment": "Test Orchestrator",
          "StartAt": "updateStatus",
          "States": {
            "Success (1)": {
              "Type": "Succeed"
            },
            "updateStatus": {
              "ItemProcessor": {
                "ProcessorConfig": {
                  "ExecutionType": "STANDARD",
                  "Mode": "DISTRIBUTED"
                },
                "StartAt": "setProvisioningStatus",
                "States": {
                  "handleProvisioningError": {
                    "End": true,
                    "Parameters": {
                      "error.$": "$.error",
                      "testId.$": "$.testId"
                    },
                    "Type": "Pass"
                  },
                  "setProvisioningStatus": {
                    "Catch": [
                      {
                        "ErrorEquals": [
                          "States.ALL"
                        ],
                        "Next": "handleProvisioningError",
                        "ResultPath": "$.error"
                      }
                    ],
                    "End": true,
                    "Parameters": {
                      "FunctionName": "arn:aws:lambda:${aws_region}:${aws_account}:function:${update_status_lambda_name}",
                      "Payload": {
                        "status": "PROVISIONING",
                        "testId.$": "$.testId"
                      }
                    },
                    "Resource": "arn:aws:states:::lambda:invoke",
                    "ResultSelector": {
                      "status.$": "$.Payload.status",
                      "testId.$": "$.Payload.testId"
                    },
                    "Retry": [
                      {
                        "BackoffRate": 2,
                        "ErrorEquals": [
                          "Lambda.ServiceException",
                          "Lambda.AWSLambdaException",
                          "Lambda.SdkClientException",
                          "Lambda.TooManyRequestsException",
                          "Extension.Crash"
                        ],
                        "IntervalSeconds": 2,
                        "MaxAttempts": 6
                      }
                    ],
                    "Type": "Task"
                  }
                }
              },
              "ItemReader": {
                "Parameters": {
                  "Bucket.$": "$.bucket",
                  "Key.$": "$.key"
                },
                "ReaderConfig": {
                  "InputType": "JSON"
                },
                "Resource": "arn:aws:states:::s3:getObject"
              },
              "ItemsPath": "$.testSets",
              "Label": "updateStatus",
              "MaxConcurrency": 1000,
              "Next": "Success (1)",
              "ResultPath": "$.testSets",
              "Type": "Map"
            }
          }
        },
        "RoleArn": "arn:aws:iam::499000064181:role/BA7PSTESTPLATFORM/7ps-orchestrator-qa-role",
        "StateMachineName": "qa-7ps-orchestrator"
      },
      "Type": "AWS::StepFunctions::StateMachine"
    }
  }
}
  1. Run command aws cloudformation deploy --stack-name stack1 --template-file {path-to-cft} --endpoint-url=http://localhost:4566

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.15.45 Python/3.11.9 Darwin/23.5.0 source/x86_64 prompt/off

Environment details (OS name and version, etc.)

MacOs 14.5 (23F79), Processor 2.3 GHz 8-Core Intel Core i9

tim-finnigan commented 3 months ago

Thanks for reaching out. I think this issue is specific to localstack, as it has been reported several times in their repository. It looks like this may have been recently fixed in the last few weeks ago via: https://github.com/localstack/localstack/pull/11073. Have you tried using 3.6.0? If you're still having issues I suggest reaching out in their repository.


When I ran aws cloudformation deploy --stack-name stack1 --template-file template.json with your template, I received the error:

An error occurred (ValidationError) when calling the CreateChangeSet operation: Template format error: Resource name qa-7ps-orchestrator is non alphanumeric.

So it looks the dashes need to be removed there for this to run. For further investigation on the CLI side we would like to see your debug logs (with any sensitive info redacted) by adding --debug to the command.

arielalas commented 3 months ago

@tim-finnigan thank you for your response, I was able to confirm that this issue is resolved using localstack version3.6.0. Thank you very much!

tim-finnigan commented 3 months ago

Thanks for letting us know! I'll go ahead and close this issue.

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.