serverless-apigateway-service-proxy
serverless-apigateway-service-proxy copied to clipboard
Fn::Sub Error / Incompatibility with serverless-pseudo-parameters
When trying to use custom request templates for Kinesis with the following syntax:
custom:
apiGatewayServiceProxies:
- kinesis:
path: /kinesis
method: post
streamName: { Ref: 'MyStream' }
request:
template:
text/plain:
Fn::Sub:
- |
#set($msgBody = $util.parseJson($input.body))
#set($msgId = $msgBody.MessageId)
{
"Data": "$util.base64Encode($input.body)",
"PartitionKey": "$msgId",
"StreamName": "#{MyStreamArn}"
}
- MyStreamArn:
Fn::GetAtt: [MyStream, Arn]
I was getting the following error:
The CloudFormation template is invalid: Template error: One or more Fn::Sub intrinsic functions don't specify expected arguments. Specify a string as first argument, and an optional second argument to specify a mapping of values to replace in the string
After much digging, I found that this was due to an incompatibility with serverless-pseudo-parameters plugin. Uninstalling serverless-pseudo-parameters resolved the issue.
I think we need a warning in the documentation or, even better, some kind of compatibility.
Might be able to close this one since sls v3 is not, will never be, compatible with serverless-pseudo-parameters. Although I'm not saying this will certainly work now.