1

I am trying to invoke step function and pass an input "id" from request path. When I invoke it, I get message

"errorMessage": "Unable to resolve property Input from source {\"id\":\"$request.path.id\"}. Please make sure that the request to API Gateway contains all the necessary fields specified in request parameters.",

How do I specify value for Input?

Type: AWS::ApiGatewayV2::Integration
DependsOn:
  - ApiGatewayHTTP
  - MyStateMachine
Properties:
  ApiId: !Ref 'ApiGatewayHTTP'
  IntegrationType: AWS_PROXY
  IntegrationSubtype: StepFunctions-StartSyncExecution
  CredentialsArn: !GetAtt MyStateMachineExecutionRole.Arn 
  RequestParameters:
    StateMachineArn: !GetAtt 'MyStateMachine.Arn'
    Input: '{"id":"$request.path.id"}'
  ConnectionType: INTERNET
  PayloadFormatVersion: 1.0
  TimeoutInMillis: 3000
epitka
  • 17,275
  • 20
  • 88
  • 141

2 Answers2

1

In the above integration snipped correct syntax is

  RequestParameters:
    StateMachineArn: !GetAtt 'MyStateMachine.Arn'
    Input: "{\"id\":$request.path.id}"

However this does not work if the path parameter is Guid, or string. One cannot invoke it just by making POST call such as POST https://some.com/0943fsre300 for example, as it will throw an error, you have to wrap parameter in a path into quotes https://some.com/"0943fsre300", you can also encode quotes. After endless back and forth with AWS support they acknowledged that this a known problem, and that they are working on a fix.

epitka
  • 17,275
  • 20
  • 88
  • 141
0

I think you make an error syntax in the RequestParameters input. To make it clear:

Yours: Input: '{"id":"$request.path.id"}'

Should be: Input: ""{"id": $request.path.id}""

You can refer to my example CloudFormation script:

  MyApiStepFunctionIntegration:
    Type: AWS::ApiGatewayV2::Integration
    Properties:
      ApiId: !Ref MyApi
      CredentialsArn: !GetAtt MyStateMachineExecutionRole.Arn
      IntegrationType: AWS_PROXY
      PayloadFormatVersion: "1.0"
      IntegrationSubtype: StepFunctions-StartSyncExecution
      RequestParameters: {"Input": "\"{\"id\": $request.path.id}\"", "StateMachineArn": !Ref MyStepFunction}

AWS official: Set up request and response data mappings using the API Gateway console

Khanh Qui
  • 11
  • 2