Skip to content

stepfunctions: DistributedMap's ResultWriter with JsonATA generate invalid CF template #35403

@TomasChmelik

Description

@TomasChmelik

Describe the bug

Regression of #33396

When specifying DistributedMap.result_writer_v2's (but same thing happends when using V1) parameters in JsonATA format, the template should contain "Arguments", but it contains "Parameters"

This causes CF stack update with These fields are required: [Arguments] at followed by path to the DistributedMap/ResultWriter error message

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

DistributedMap/ResultWriter has Arguments property where target bucket and prefix is set.

      DefinitionString:
        Fn::Join:
          - ""
          - - '{"StartAt":"DistributedMap","States":{"DistributedMap":{"Type":"Map","QueryLanguage":"JSONata","End":true,"ItemProcessor":{"ProcessorConfig":{"Mode":"DISTRIBUTED","ExecutionType":"STANDARD"},"StartAt":"Pass","States":{"Pass":{"Type":"Pass","End":true}}},"ResultWriter":{"Resource":"arn:'
            - Ref: AWS::Partition
            - :states:::s3:putObject","Arguments":{"Bucket":"
            - Ref: Bucket83908E77
            - '","Prefix":"{% $states.input.prefix %}"}}}}}'

Current Behavior

DistributedMap/ResultWriter has Parameters property where target bucket and prefix is set, even though the DistributedMap has JsonATA query language selected

      DefinitionString:
        Fn::Join:
          - ""
          - - '{"StartAt":"DistributedMap","States":{"DistributedMap":{"Type":"Map","QueryLanguage":"JSONata","End":true,"ItemProcessor":{"ProcessorConfig":{"Mode":"DISTRIBUTED","ExecutionType":"STANDARD"},"StartAt":"Pass","States":{"Pass":{"Type":"Pass","End":true}}},"ResultWriter":{"Resource":"arn:'
            - Ref: AWS::Partition
            - :states:::s3:putObject","Parameters":{"Bucket":"
            - Ref: Bucket83908E77
            - '","Prefix":"{% $states.input.prefix %}"}}}}}'

Reproduction Steps

from aws_cdk import aws_stepfunctions, aws_s3

bucket = aws_s3.Bucket(self, 'Bucket')

distributed_map = aws_stepfunctions.DistributedMap(
    self,
    'DistributedMap',
    query_language=aws_stepfunctions.QueryLanguage.JSONATA,
    # doesn't work for either
    result_writer=aws_stepfunctions.ResultWriter(
        bucket=bucket,
        prefix='{% $states.input.prefix %}',
    ),
    # ...or v2
    result_writer_v2=aws_stepfunctions.ResultWriterV2(
        bucket=bucket,
        prefix='{% $states.input.prefix %}',
    ),
)
distributed_map.item_processor(aws_stepfunctions.Pass(self, 'Pass'))

aws_stepfunctions.StateMachine(
    self,
    'StateMachine',
    definition_body=aws_stepfunctions.DefinitionBody.from_chainable(distributed_map),
    state_machine_name='state-machine',
)

Possible Solution

No response

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.214.0

AWS CDK CLI version

2.1027.0

Node.js Version

v22.9.0

OS

Ubuntu

Language

Python

Language Version

Python (3.13)

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsbugThis issue is a bug.effort/mediumMedium work item – several days of effortp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions