serverless-express icon indicating copy to clipboard operation
serverless-express copied to clipboard

'Unable to determine event source based on event.' Lambda to Lambda Invoke

Open esphoenixc opened this issue 3 years ago • 2 comments

Hello, I am trying to catch event parameters from Lambda A which invokes Lambda B with event parameter.

I was trying to use getCurrentInvoke() at the global level to catch it, but unfortunately it was futile.

How can I catch event parameter passed when invoked by another Lambda?

The Lambda b is for my slack app that I deployed onto Lambda.

at the end of the file it has this exports.handler

module.exports.handler = serverlessExpress({
  app: receiver.app,
});

I believe this is the place where I need to grab the event parameter. So far, what I've done is this :

exports.handler = async (event, context) => {
  console.log(event, context);
  return serverlessExpress({
    app: receiver.app,
  });
};

-----------

module.exports.handler = async (event, context) => {
  console.log(event, context);
  return serverlessExpress({
    app: receiver.app,
  });
};

none worked out for me :( I am very new to this serverless and backend logic stuff so please shed some knowledge! I greatly appreaciate!

esphoenixc avatar Aug 24 '22 08:08 esphoenixc

We don't currently support Lambda invokes, but you can provide a custom mapper. Here's an example for DynamoDB https://github.com/vendia/serverless-express/tree/mainline/examples/custom-mapper-dynamodb

brettstack avatar Sep 01 '22 22:09 brettstack

hi @brettstack is there a task or a plan to add this feature? also in the dynamo db example you override the eventSource logic, so you cant use the Sns mapper for instance unless you add it yourself. In my case it will be better to have the option to add a new event type and also use the available events types mappers which the package provides like sns.

In my case, I want to invoke lambda function from a step function state. The lambda function I am using is already handle Api gateway and sns events.

yogevy avatar Oct 08 '22 08:10 yogevy