8000 bug: DistributedMap Step Misinterprets Input Structure in LocalStack · Issue #11840 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content
bug: DistributedMap Step Misinterprets Input Structure in LocalStack #11840
Closed
@gerson24

Description

@gerson24

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I’ve encountered a discrepancy between AWS Step Functions behavior and LocalStack behavior when using a DistributedMap step in a State Machine. In AWS, the DistributedMap correctly accesses fields from the initial context input. However, in LocalStack, the DistributedMap appears to restrict its accessible fields solely to the items specified in itemsPath, leading to a failure when referencing fields outside of values.

For instance, in the following implementation:

const initialStep = new Pass(this, 'Initial step', {
  parameters: {
    bucket: 'test-bucket',
    values: ['1', '2', '3']
  },
  resultPath: '$.content'
});

const mapStep = new DistributedMap(this, 'Map step', {
  itemsPath: '$.content.values',
  itemSelector: {
    bucketName: JsonPath.stringAt('$.content.bucket'),
    value: JsonPath.numberAt('$$.Map.Item.Value')
  },
  resultPath: JsonPath.DISCARD
}).itemProcessor(endStep);

The DistributedMap step should have access to $.content.bucket as well as each item in values.

In LocalStack, when running the above configuration, the DistributedMap only processes values directly without access to $.content.bucket. As a result, trying to access bucket in itemSelector fails with an error:

2024-11-13T13:28:56.932 ERROR --- [-1398 (eval)] l.s.s.a.c.eval_component   : Exception=FailureEventException, 
Error=States.Runtime, Details={"taskFailedEventDetails": {"error": "States.Runtime", "cause": "The JSONPath 
$.content.bucket specified for the field bucketName.$ could not be found in the input [\"1\", \"2\", \"3\"]"}} at '(ItemSelector| 
{'payload_tmpl': (PayloadTmpl| {'payload_bindings': [(PayloadBindingPath| {'field': 'bucketName', 'path': '$.content.bucket'}, 
(PayloadBindingPathContextObj| {'field': 'value', 'path_context_obj': '$.Map.Item.Value'}]}}'

Expected Behavior

The distributedMap step must have access to input fields.

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

  1. Launch LocalStack with the client.
  2. Deploy and execute the Step Function.

Environment

- OS: macOS sonoma 14.7
- LocalStack version: 3.8.1

Anything else?

Even though an error occurs, the execution of the Step Function still returns "status": "SUCCEEDED".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0