Skip to content

bug: Step Function mocks has a different behaviour to AWS SFN Local how they work when using Maps #12846

Open
@chris-dco

Description

@chris-dco

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Background

We have a Step Function which uses a Map type. Currently we have a test which takes in an array of two items and tests that if a Lambda within the Map fails on the second item that the error handling will handle the error correctly.

Test Background

The test we are currently using in AWS Step Function local uses a mocked response similar to the following.

{
  "TestFunctionMockedSuccessOneFailureOne": {
    "0": {
      "Return": {
        "StatusCode": 200
      }
    },
    "1-3": {
      "Throw": {
        "Error": "Lambda.AWSLambdaException",
        "Cause": "Some Lambda error."
      }
    }
  }
}

Expected behaviour

We are expecting AWS Step Function Local and Local Stack to handle this scenario in a similar way. In which case the response of the first iteration of the Map will return {"StatusCode":200} and subsequent iterations of the Map will fail with a Lambda.AWSLambdaException. This enables us to test that the error handling is working correctly.

Actual Behaviour

The behaviour of Local Stack however is very different to AWS Step Function Local, instead both iterations within the Map will pass and therefore the existing test fails as the error handling code is not executed.

Expected Behavior

We would expect Local Stack to act in an identical way as AWS Step Function Local and Local Stack to handle this scenario in a similar way. In which case the response of the first iteration of the Map will return {"StatusCode":200} and subsequent iterations of the Map will fail with a Lambda.AWSLambdaException. This enables us to test that the error handling is working correctly.

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

Environment

- OS: macOS Sequoia 15.5
- LocalStack:
  LocalStack version: 4.6.0
  LocalStack Docker image sha: 467827579d31
  LocalStack build date: 2025-07-03
  LocalStack build git hash: b16cabc9b

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions