invoke aws lambda from another lambda asynchronously

后端 未结 5 2081
小蘑菇
小蘑菇 2020-12-09 03:24

I need to invoke aws lambda from another lambda asynchronously. i have a working code for synchronous calls.

exports.handler = (event, context, callback) =&g         


        
5条回答
  •  不知归路
    2020-12-09 04:20

    Per the Lambda invoke() documentation, you will see that by default the Lambda function is invoked using the RequestResponse invocation type. To invoke the function asynchronously you need to specify the Event invocation type, like so:

    lambda.invoke({
        FunctionName: 'testLambda',
        InvocationType: 'Event',
        Payload: JSON.stringify(event, null, 2)
    },function(err,data){});
    

提交回复
热议问题