Calling a lambda within a NestJS project

Calling a lambda within a NestJS project

Hi, I have a project with NestJS, Lambda, Serverless architecture. So each Nest application is a lambda.

The problem I have, is that I need to call inside a lambda, to another lambda of the same project.
I am doing it with invoke. The call goes in fine, I see it in the logs, but the problem is that I get an empty client-context. So I am failing in the parameters issue.

If anyone has done it and has a suggestion.


You have each nest application as a Lambda? That sounds strange.

Regardless, we use an npm package GitHub - peak-ai/ais-service-discovery-js and put the lambdas in cloudmap, and this library does both in one shot (looks up the lambda by name via cloudmap then invokes it) and greatly simplifies things rather than doing manual invoke commands.

const ServiceDiscovery = require('@peak-ai/ais-service-discovery');
await ServiceDiscovery.request('namespace.service->handler',  body);

They also have a serverless plugin GitHub - peak-ai/serverless-cloudmap: Serverless plugin for Cloudmap whicih is how you get your lambda functions registered into cloudmap in the first place.