I’ve done this through the AWS Console, but can’t seem to make it work via serverless.
I believe the problem lies in the fact that in serverless the http.integration is required to be a string, while CloudFormation expects it to be an Integration object which includes defining the RequestParameters list property.
The relevant section of my serverless.yml is:
search:
handler: applications/dummy.handler
events:
- http:
path: /restapi/v1/search
method: get
cors: true
authorizer:
arn: "arn:aws:cognito-idp:${self:custom.currentRegion}:############:userpool/${self:custom.userPoolId}"
integration: http
request:
uri: "https://<cloudsearch-url-stuff>.<region>.cloudsearch.amazonaws.com/2013-01-01/search"
parameters:
'method.request.querystring.fq': false
'method.request.querystring.pretty': false
'method.request.querystring.q': true
'method.request.querystring.q.cursor': false
'method.request.querystring.q.options': false
'method.request.querystring.q.parser': false
'method.request.querystring.return': false
'method.request.querystring.size': false
'method.request.querystring.sort': false
'method.request.querystring.start': false
response:
statusCodes:
200:
pattern: ''
The above successfully creates everything up to and including defining the querystring parameters on the API Gateway MethodRequest. But after sifting through the serverless source, I can’t find any way to define the required mapping in the IntegrationRequest.
Am I missing something?(probably)
Any help would be appreciated.