5

I have a Type: AWS::Serverless::HttpApi which I am trying to connect to a Type: AWS::Serverless::StateMachine as a trigger. Meaning the HTTP API would trigger the Step Function state machine.

I can get it working, by only specifying a single input. For example, the DefinitionBody when it works, looks like this:

      DefinitionBody:
        info:
          version: '1.0'
          title:
            Ref: AWS::StackName
        paths:
          "/github/secret":
            post:
              responses: 
                default:
                  description: "Default response for POST /"
              x-amazon-apigateway-integration:
                integrationSubtype: "StepFunctions-StartExecution"
                credentials:
                  Fn::GetAtt: [StepFunctionsApiRole, Arn]
                requestParameters:
                  Input: $request.body
                  StateMachineArn: !Ref SecretScannerStateMachine
                payloadFormatVersion: "1.0"
                type: "aws_proxy"
                connectionType: "INTERNET"
                timeoutInMillis: 30000
        openapi: 3.0.1
        x-amazon-apigateway-importexport-version: "1.0"

Take note of the following line: Input: $request.body. I am only specifying the $request.body.

However, I need to be able to send the $request.body and $request.header.X-Hub-Signature-256. I need to send BOTH these values to my state machine as an input.

I have tried so many different ways. For example:

Input: " { body: $request.body, header: $request.header.X-Hub-Signature-256 }"

and

Input:
  $request.body
  $request.header.X-Hub-Signature-256 

and

Input: $request

Nothing seems to work. I am trying to follow the documentation here:

But nothing seems to point on how to pass multiple vars, only one.

I get different errors each time, but this is the main one:

Warnings found during import: Unable to create integration for resource at path 'POST /github/secret': Invalid selection expression specified: Validation Result: warnings : [], errors : [Invalid source: $request specified for destination: Input].

Any help on how to pass multiple values would so be appreciated.

user3180997
  • 1,836
  • 3
  • 19
  • 31

1 Answers1

0

According to this repost.aws post which describes a similar scenario:

What you want is not supported by HTTP API. You can achieve this with REST API and request mapping.

So try using a REST API instead.

Tom Gregory
  • 105
  • 6