According to the AWS docs you need to set in the Integration Request header X-Amz-Invocation-Type set to ‘Event’ (using single quotes) and integration type to AWS Service.
events:
- http:
path: sfNotify
method: POST
cors: true
private: true
integration: lambda
request:
passThrough: WHEN_NO_MATCH
parameters:
headers:
'X-Amz-Invocation-Type': "'Event'"
The mapped from value created is method.request.header.X-Amz-Invocation-Type not ‘Event’
What am I doing wrong?
Looking at the cloudformation generated:
jjkirby:
Looking at the cloudformation generated:
ApiGatewayMethodSfnotifyPost": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"HttpMethod": "POST",
"RequestParameters": {
"method.request.header.X-Amz-Invocation-Type": "'Event'"
},
....
"RequestParameters": {
"integration.request.header.X-Amz-Invocation-Type": "method.request.header.X-Amz-Invocation-Type"
}
},
What needs to be set in RequestParameters I think is :
“integration.request.header.X-Amz-Invocation-Type”: “‘Event’”
Where and how do you set this in the serverless.yml file?
What needs to be set in RequestParameters I think is :
“integration.request.header.X-Amz-Invocation-Type”: “‘Event’”
Where and how do you set this in the serverless.yml file?
I solved it by overriding the the CF Resource (https://serverless.com/framework/docs/providers/aws/guide/resources/#override-aws-cloudformation-resource )
Functions looks like this:
sfProxy:
handler: com.captech.sf.ProxySFHandler
package:
individually: true
artifact: ./sf-proxy/target/sfproxy-1.0-SNAPSHOT.jar
events:
- http:
path: sfNotify
method: POST
cors: true
private: true
integration: aws
request:
passThrough: WHEN_NO_MATCH
parameters:
headers:
'X-Amz-Invocation-Type': "'Event'"
Resource to override looks like this:
resources:
Resources:
ApiGatewayMethodSfnotifyPost:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: POST
Integration:
IntegrationHttpMethod: POST
Type: "AWS"
RequestParameters:
"integration.request.header.X-Amz-Invocation-Type": "'Event'"
1 Like
bill
March 27, 2018, 11:43pm
4
Can I ask to reformat all codes with proper indentation?