Skip to content

(@aws-cdk/aws-stepfunction-tasks): Unnecessary validation of field "Headers" in CallApiGatewayRestApiEndpoint #14181

Closed
@paraspra

Description

@paraspra

The validation of Header property in constructor of CallApiGatewayRestApiEndpoint is unnecessary as StepFunction UI (i.e Amazon States Language) allows apigateway:invoke.waitForTaskToken without "Header" property.

Also, as per HttpHeaderDeserializer in StepFunctionsHttpConnectors , Headers property is deserialized as Map<String, List<String>> . Constructing this structure in CDK with JsonPath is currently not possible.

This validation is enforcing to add headers: TaskInput.fromObject({ TaskToken: JsonPath.taskToken) in CallApiGatewayRestApiEndpoint props. When task with this configuration is deployed and run in AWS StepFunction it throws errror parameter could not be used to start the Task: [The value of the field 'Headers' has an invalid format]"

Reproduction Steps

create Task, and deploy it. Try to run this stepFunction.

const task = new CallApiGatewayRestApiEndpoint(this, title, {
            api: restAPI,
            method: HttpMethod.PUT,
            stageName: apiStage,
            requestBody: TaskInput.fromObject({})
            authType: AuthType.IAM_ROLE,
            apiPath: apiPath,
            resultPath: resultPath,
            headers: TaskInput.fromObject({ TaskToken: JsonPath.taskToken),
            integrationPattern: IntegrationPattern.WAIT_FOR_TASK_TOKEN
          })

What did you expect to happen?

Task should make a call to the ApiGateway

What actually happened?

Exception during task execution
parameter could not be used to start the Task: [The value of the field 'Headers' has an invalid format]"

Environment

  • CDK CLI Version : 1.96.0
  • Framework Version: 1.96.0
  • Node.js Version: v14.6.0
  • OS : MacOS
  • Language (Version): TypeScript

Other


This is 🐛 Bug Report

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