Skip to content

bug: Step Functions doesn't correctly throw error for undefined value #11980

Closed
@peter-smith-phd

Description

@peter-smith-phd

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The following Step Functions state machine does not correctly fail when $.foo is encountered.

{
  "StartAt": "FirstState",
  "States": {
    "FirstState": {
      "Type": "Pass",
      "Result": {},
      "Next": "ChoiceState"
    },
    "ChoiceState": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.foo",
          "NumericEquals": 1,
          "Next": "DefaultState"
        },
        {
          "Variable": "$.foo",
          "NumericEquals": 2,
          "Next": "DefaultState"
        }
      ],
      "Default": "DefaultState"
    },
    "DefaultState": {
      "Type": "Pass",
      "End": true
    }
  }
}

The output from describe-execution is (incorrectly)

{
    "executionArn": "arn:aws:states:us-east-1:000000000000:execution:Fail_errors:34935b1a-8ce6-4ba1-8590-5a1ece6c031c",
    "stateMachineArn": "arn:aws:states:us-east-1:000000000000:stateMachine:Fail_errors",
    "name": "34935b1a-8ce6-4ba1-8590-5a1ece6c031c",
    "status": "SUCCEEDED",
    "startDate": "2024-12-03T21:05:53.605120+00:00",
    "stopDate": "2024-12-03T21:05:53.983605+00:00",
    "input": "{}",
    "inputDetails": {
        "included": true
    },
    "output": "{}",
    "outputDetails": {
        "included": true
    }
}

Expected Behavior

The output from describe-execution in AWS shows FAILURE:

{
    "executionArn": "arn:aws:states:us-east-1:xxxxxxxxxxxx:execution:Fail_errors:9fa92b58-e97a-44d8-af01-66d1b78d5846",
    "stateMachineArn": "arn:aws:states:us-east-1:xxxxxxxxxxxx:stateMachine:Fail_errors",
    "name": "9fa92b58-e97a-44d8-af01-66d1b78d5846",
    "status": "FAILED",
    "startDate": "2024-12-03T21:01:54.920000+00:00",
    "stopDate": "2024-12-03T21:01:54.987000+00:00",
    "input": "{}",
    "inputDetails": {
        "included": true
    }
}

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 --region us-east-1 stepfunctions create-state-machine --name "Fail_errors" --definition file://file.asl.json --role-arn arn:aws:iam::000000000000:role/Admin
    awslocal --region us-east-1 stepfunctions start-execution --state-machine-arn arn:aws:states:us-east-1:000000000000:stateMachine:Fail_errors  
    awslocal --region us-east-1 stepfunctions describe-execution --execution-arn arn:aws:states:us-east-1:000000000000:execution:Fail_errors:34935b1a-8ce6-4ba1-8590-5a1ece6c031c

Environment

- OS:
- LocalStack:
  LocalStack version: 4.0.4.dev5
  LocalStack build date: 2024-12-03
  LocalStack build git hash: 78fdf458f

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