${stageVariables.xxxxxx} for lambda function name of serverless event http
See original GitHub issueThis is a (Bug Report / Feature Proposal)
Not sure if this is a feature proposal or maybe I just don’t know if it even exists
Description
We are new to serverless arch and we are trying to setup serverless in our AWS environment for dry run testing. We can’t find a way how to setup ${stageVariables.<string|variable|function|xxxx>} to event http.
When I setup the lambda function name like below:
functions:
root-lambda:
handler: index.handler
name: "${stageVariables.strname}"
events:
- http:
path: /api/v1
method: get
integration: lambda
request:
passThrough: WHEN_NO_MATCH
I get an error:
The CloudFormation template is invalid: Template error: instance of Fn::Sub references invalid resource attribute stageVariables.strname
If I add the “!” for lambda function name, it gives different error:
functions:
root-lambda:
handler: index.handler
name: "${!stageVariables.strname}"
events:
- http:
path: /api/v1
method: get
integration: lambda
request:
passThrough: WHEN_NO_MATCH
}
I get this error:
An error occurred: RootlambdaLogGroup - 1 validation error detected: Value '/aws/lambda/${!stageVariables.strname}' at 'logGroupNamePrefix' failed to satisfy constraint: Member must satisfy regular expression pattern: [\.\-_/#A-Za-z0-9]+.
serverless -v 1.24.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:12 (3 by maintainers)
@sebastian-fredriksson-bernholtz, Unfortunately no, at the end we stick with the solution I described… I’ll check my code base and try to recuperate the solution in serverless.yml
@neverendingqs here is an example of what I believe @markjayniel was trying to do. Would be interested to know if this is supported or not as I haven’t found much on it.