Skip to content

aws-stepfunctions: Distributed Map State Item Processor executionType doesn't recognize ProcessorType.EXPRESS #30194

@Commas929

Description

@Commas929

Describe the bug

I have the following piece of CDK code but when I deploy it and check in AWS console, the step function execution type for the map run is Standard instead of Express.

The code:

    const qotOverrideDistributedMapState = new DistributedMap(this, 'Distributed Map State', {
      maxConcurrency: 1000,
      itemBatcher: new ItemBatcher({
        maxItemsPerBatch: 10
      }),
      itemReader: new S3CsvItemReader({
        bucket: qotOverrideBucket,
        key: JsonPath.stringAt('$.s3Key'),
        csvHeaders: CsvHeaders.useFirstRow()
      }),
      resultWriter: new ResultWriter({
        bucket: qotOverrideBucket,
        prefix: 'QoTOverrideProcessingResult',
      }),
      toleratedFailureCount: 0,
    }).itemProcessor(new LambdaInvoke(this, 'Invoke Lambda Processor', {
      lambdaFunction: qotOverrideProcessor,
    }), {
      mode: ProcessorMode.DISTRIBUTED,
      executionType: ProcessorType.EXPRESS,
    })

    const qotOverrideFileProcessor = new StateMachine(this, 'QoT Override File Processor', {
      role: Role.fromRoleArn(this, 'QoT-Override-File-Processor-SfnRole', qotOverrideSfnRole.roleArn, {
        mutable: false,
      }),
      definitionBody: DefinitionBody.fromChainable(qotOverrideDistributedMapState),
      stateMachineName: 'QoT-Override-File-Processor-Sfn',
      stateMachineType: StateMachineType.STANDARD,
      logs: {
        destination: new LogGroup(this, 'QoT-Override-File-Processor-LogGroup', {
          retention: RetentionDays.THREE_MONTHS,
          logGroupName: 'QoT-Override-File-Processor-Log',
        }),
        level: LogLevel.ERROR,
        includeExecutionData: true,
      },
    })

The generated State Machine definition copied from AWS console:

{
  "StartAt": "Distributed Map State",
  "States": {
    "Distributed Map State": {
      "Type": "Map",
      "End": true,
      "ItemProcessor": {
        "ProcessorConfig": {
          "Mode": "DISTRIBUTED",
          "ExecutionType": "STANDARD"
        },
        "StartAt": "Invoke Lambda Processor",
        "States": {
          "Invoke Lambda Processor": {
            "End": true,
            "Retry": [
              {
                "ErrorEquals": [
                  "Lambda.ClientExecutionTimeoutException",
                  "Lambda.ServiceException",
                  "Lambda.AWSLambdaException",
                  "Lambda.SdkClientException"
                ],
                "IntervalSeconds": 2,
                "MaxAttempts": 6,
                "BackoffRate": 2
              }
            ],
            "Type": "Task",
            "Resource": "arn:aws:states:::lambda:invoke",
            "Parameters": {
              "FunctionName": "arn:aws:lambda:us-east-1:502523373620:function:QoTOverrideProcessor",
              "Payload.$": "$"
            }
          }
        }
      },
      "MaxConcurrency": 1000,
      "ItemReader": {
        "Resource": "arn:aws:states:::s3:getObject",
        "ReaderConfig": {
          "InputType": "CSV",
          "CSVHeaderLocation": "FIRST_ROW"
        },
        "Parameters": {
          "Bucket.$": "$.s3Bucket",
          "Key.$": "$.s3Key"
        }
      },
      "ItemBatcher": {
        "MaxItemsPerBatch": 10
      },
      "ResultWriter": {
        "Resource": "arn:aws:states:::s3:putObject",
        "Parameters": {
          "Bucket.$": "$.s3Bucket",
          "Prefix": "QoTOverrideProcessingResult"
        }
      }
    }
  }
}

Expected Behavior

The ItemProcessor execution type should be Express

Current Behavior

The ItemProcessor execution type is Standard and the specified type in CDK is ignored.

Reproduction Steps

    const bucket = new Bucket(this, 'Bucket', {});
    const distributedMapState = new DistributedMap(this, 'Distributed Map State', {
      maxConcurrency: 1000,
      itemReader: new S3CsvItemReader({
        bucket: bucket,
        key: JsonPath.stringAt('$.s3Key'),
        csvHeaders: CsvHeaders.useFirstRow()
      }),
      toleratedFailureCount: 0,
    }).itemProcessor(new Pass(this, 'Pass State', {}), {
      mode: ProcessorMode.DISTRIBUTED,
      executionType: ProcessorType.EXPRESS,
    })

    const fileProcessor = new StateMachine(this, 'File Processor', {
      definitionBody: DefinitionBody.fromChainable(distributedMapState),
      stateMachineName: 'File-Processor-Sfn',
      stateMachineType: StateMachineType.STANDARD,
    })

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.136.0

Framework Version

No response

Node.js Version

NodeJS-18

OS

macOS Sonoma 14.4.1

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-stepfunctionsRelated to AWS StepFunctionsbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions