Skip to content

bug: Step Functions throw InvalidDefinition exception for a valid JSONata definition #12048

@tereschenkov

Description

@tereschenkov

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm using the following definition

{
  "QueryLanguage": "JSONata",
  "Comment": "A description of my state machine",
  "StartAt": "Choice",
  "States": {
    "Choice": {
      "Type": "Choice",
      "Choices": [
        {
          "Next": "Fail",
          "Condition": "{% $states.input.status != \"success\" %}",
          "Output": {
            "execution_id": "{% $ExecutionId %}",
            "notification_type": "{% $states.input.status %}"
          }
        }
      ],
      "Default": "Success"
    },
    "Fail": {
      "Type": "Fail"
    },
    "Success": {
      "Type": "Succeed"
    }
  }
}

When I execute

awslocal stepfunctions create-state-machine --name "test" \
      --role-arn "arn:aws:iam::000000000000:role/step_function_role" \
      --definition file://test.json \
      --type STANDARD

the output is

localstack-1  | An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: ASLParserException ['line 34:10, at "Output", mismatched input \'"Output"\' expecting {\'"Comment"\', \'"Condition"\', \'"Variable"\', \'"BooleanEquals"\', \'"BooleanEqualsPath"\', \'"IsBoolean"\', \'"IsNull"\', \'"IsNumeric"\', \'"IsPresent"\', \'"IsString"\', \'"IsTimestamp"\', \'"NumericEquals"\', \'"NumericEqualsPath"\', \'"NumericGreaterThan"\', \'"NumericGreaterThanPath"\', \'"NumericGreaterThanEquals"\', \'"NumericGreaterThanEqualsPath"\', \'"NumericLessThan"\', \'"NumericLessThanPath"\', \'"NumericLessThanEquals"\', \'"NumericLessThanEqualsPath"\', \'"StringEquals"\', \'"StringEqualsPath"\', \'"StringGreaterThan"\', \'"StringGreaterThanPath"\', \'"StringGreaterThanEquals"\', \'"StringGreaterThanEqualsPath"\', \'"StringLessThan"\', \'"StringLessThanPath"\', \'"StringLessThanEquals"\', \'"StringLessThanEqualsPath"\', \'"StringMatches"\', \'"TimestampEquals"\', \'"TimestampEqualsPath"\', \'"TimestampGreaterThan"\', \'"TimestampGreaterThanPath"\', \'"TimestampGreaterThanEquals"\', \'"TimestampGreaterThanEqualsPath"\', \'"TimestampLessThan"\', \'"TimestampLessThanPath"\', \'"TimestampLessThanEquals"\', \'"TimestampLessThanEqualsPath"\', \'"Next"\', \'"Assign"\'}', 'line 36:12, at "notification_type", mismatched input \'"notification_type"\' expecting {\'"Comment"\', \'"Condition"\', \'"Variable"\', \'"BooleanEquals"\', \'"BooleanEqualsPath"\', \'"IsBoolean"\', \'"IsNull"\', \'"IsNumeric"\', \'"IsPresent"\', \'"IsString"\', \'"IsTimestamp"\', \'"NumericEquals"\', \'"NumericEqualsPath"\', \'"NumericGreaterThan"\', \'"NumericGreaterThanPath"\', \'"NumericGreaterThanEquals"\', \'"NumericGreaterThanEqualsPath"\', \'"NumericLessThan"\', \'"NumericLessThanPath"\', \'"NumericLessThanEquals"\', \'"NumericLessThanEqualsPath"\', \'"StringEquals"\', \'"StringEqualsPath"\', \'"StringGreaterThan"\', \'"StringGreaterThanPath"\', \'"StringGreaterThanEquals"\', \'"StringGreaterThanEqualsPath"\', \'"StringLessThan"\', \'"StringLessThanPath"\', \'"StringLessThanEquals"\', \'"StringLessThanEqualsPath"\', \'"StringMatches"\', \'"TimestampEquals"\', \'"TimestampEqualsPath"\', \'"TimestampGreaterThan"\', \'"TimestampGreaterThanPath"\', \'"TimestampGreaterThanEquals"\', \'"TimestampGreaterThanEqualsPath"\', \'"TimestampLessThan"\', \'"TimestampLessThanPath"\', \'"TimestampLessThanEquals"\', \'"TimestampLessThanEqualsPath"\', \'"Next"\', \'"Assign"\'}', "line 38:8, at }, extraneous input '}' expecting {',', ']'}"]

Expected Behavior

When I put the same definition in the AWS console, it works fine, so the definition is correct and localstack should also accept it

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

Save provided definition as a file and then run

awslocal stepfunctions create-state-machine --name "test" \
      --role-arn "arn:aws:iam::000000000000:role/step_function_role" \
      --definition file://test.json \
      --type STANDARD

Environment

- OS: MacOS
- LocalStack: 4.0.3
  LocalStack version: 4.0.3
  LocalStack Docker image sha:a5cee08c43e594a095c7ce833775d5d534c33a836b94b9fff5aa41fcca361975
  LocalStack build date: 2024-11-29
  LocalStack build git hash: aa795ed1c

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions