我有一个Type: AWS::Serverless::HttpApi
我试图连接到Type: AWS::Serverless::StateMachine
一个触发器。这意味着 HTTP API 将触发 Step Function 状态机。
我可以让它工作,只指定一个输入。例如,DefinitionBody
当它工作时,看起来像这样:
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"
请注意以下行:Input: $request.body
. 我只指定$request.body
.
但是,我需要能够发送$request.body
and $request.header.X-Hub-Signature-256
。我需要将这两个值作为输入发送到我的状态机。
我尝试了很多不同的方法。例如:
Input: " { body: $request.body, header: $request.header.X-Hub-Signature-256 }"
和
Input:
$request.body
$request.header.X-Hub-Signature-256
和
Input: $request
似乎没有任何效果。我正在尝试遵循此处的文档:
- 使用 HTTP API 的 OpenAPI 定义。
- x-amazon-apigateway-集成对象
- x-amazon-apigateway-integration.requestParameters 对象
- 使用适用于 HTTP API 的 AWS 服务集成
- StepFunctions-StartExecution
- 开始执行
但是似乎没有任何关于如何传递多个变量的问题,只有一个。
我每次都会遇到不同的错误,但这是主要的错误:
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].
任何有关如何传递多个值的帮助将不胜感激。