how can I wait for a function to be created before a resource is created?
the key “DependsOn” only works to wait for other resources and not the lambda created within the “function” key of the serverless.yml.
when i try to insert the name of lambda inside a DependsOn i reveive this error:
Error --------------------------------------------------
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [customResourceLambda] in the Resources block of the template
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
I solved the problem, I went to see inside the stack file, inside the folder .serverless, in addition to adding LambdaFunction to the end of the name I had set, serverless also changes the first letter, from lowercase to uppercase, so now instead of putting customResourceLambdaLambdaFunction I put CustomResourceLambdaLambdaFunction and it works.
Your function defined in serverless.yml is converted into a cloudformation resource under the hood. The resource is called XLambdaFunction where X = The name of your function with the first letter capitalized.
So if you have:
functions:
hello:
handler: handler.hello
...other function stuff...