我有一个 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"
请注意以下行:输入:$request.body。我只指定 $request.body。
但是,我需要能够发送 $request.body 和 $request.header.X-Hub-Signature-256。我需要将这两个值作为输入发送到我的状态机。
我尝试了很多不同的方法。例如:
Input: " { body: $request.body, header: $request.header.X-Hub-Signature-256 }"
和
$request.body
$request.header.X-Hub-Signature-256
和
Input: $request
我每次都会遇到不同的错误,但这是主要的错误:
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].
任何有关如何传递多个值的帮助将不胜感激。