Somehow I cannot figure out how to use the DependsOn-Property correctly. I want to deploy a lambda function and also add a metric on the logs in one deploy. This fails because the logs are not created yet when serverless would like to create the Metric. I found out that there is a property for my serverless.yml called DependsOnbut this throws the following error.
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [myFunction] in the Resources block of the template
I also tried
DependsOn:
- Ref: myFunction
but this throws:
The CloudFormation template is invalid: Template format error: Every DependsOn value must be a string.
The function name (that you need to pass to DependsOn) is not the name of your function in your serverless.yml definition - it is the Logical Resource ID of the resource in CloudFormation (see the docs for details), which is generated by Serverless for you when it compiles your CloudFormation template.
Another way to work it out is to compile your template (using the “sls package” command) and inspect the file created in the .serverless directory of your service.
i am getting this error
CloudFormation template is invalid: Template format error: Unresolved resource dependencies [/aws/lambda/dc-dev-get, getLambdaFunction] in the Resources block of the template