Skip to content

bug: Step Functions doesn't evaluate $states.input correctly #12061

@peter-smith-phd

Description

@peter-smith-phd

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In this example, the state machine should end up in the Fail state, but incorrectly reaches the Success state. This appears similar to #12048, but that issue is reporting a failure to parse the ASL, rather than incorrect behaviour in the execution.

{
  "StartAt": "Pass",
  "QueryLanguage": "JSONata",
  "States": {
    "Pass": {
      "Type": "Pass",
      "Output": {
        "status": "BAD"
      },
      "Next": "Choice"
    },
    "Choice": {
      "Type": "Choice",
      "Choices": [
        {
          "Next": "Fail",
          "Condition": "{% $states.input.status != \"OK\" %}"
        }
      ],
      "Default": "Success"
    },
    "Fail": {
      "Type": "Fail"
    },
    "Success": {
      "Type": "Succeed"
    }
  }
}

Expected Behavior

According to the AWS Step Functions service, the execution should end up in the Fail state.

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-compose up

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

    awslocal stepfunctions create-state-machine --name "testing-choice" --definition file://file.asl.json --role-arn arn:aws:iam::000000000000:role/Admin

I then started an execution via the Step Functions console. The execution history page shows the incorrect execution path.

Environment

- OS: Darwin peter-mac.local 24.1.0 Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64
- LocalStack:
  LocalStack version: 4.0.4.dev63
  LocalStack build date: 2024-12-20
  LocalStack build git hash: 96eec2edd

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