Reputation: 436
I have a problem facing to invoke an AWS.Lambda function from within another lambda function in local machine by using sls offline
Could anyone can help me on this
I aleady try with child_process(spawn), but i failed
Thanks for your reponse
Upvotes: 0
Views: 612
Reputation: 277
Easiest way to invoke another lambda function is to use the AWS SDK.
Note that lambda functions are not meant to be used just like normal functions in code. Normally functions can be used to factor your code to smaller parts, and to make it reusable in other cases. While you should probably still write the actual code this way, the you might want to deploy only larger entities as lambda functions. If you have a lot of code shared between the lambda functions you can consider using Layers to share the common code.
If having multiple lambda functions can't be avoided, step functions are probably the way to build that structure.
Upvotes: 1
Reputation: 9814
The best way to manage workflows that involve mutiple Lambda functions is to use Step Functions. Then you can use the serverless-step-functions module combined with serverless-step-functions-offline for local development.
Upvotes: 1