Why does AWS Lambda function always time out?

前端 未结 3 1745
暗喜
暗喜 2020-12-17 08:50

I am testing out aws lambda, using nodejs with the 4.3 version. I\'m able to successfully complete all the statements in my handler function within the console test, which i

3条回答
  •  隐瞒了意图╮
    2020-12-17 09:30

    I was triggering a lambda from android code. The lambda was performing a heavy data lifting operation from DynamoDB and generating a JS object as a response. I could see the generated object in my lambda logs, but my android side code always timed out waiting for a response.

    The reason for timeout was the Invocation payload (request and response) limit of 6 MB for synchronous and 256 KB for asynchronous lambda implementation. In my case I had a asynchronous implementation and the resultant object was over 256 KB.

    There was no appropriate log message for overshooting this limit which derailed me. Reference: https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

    The workaround I implemented was writing the response to a text file in S3 bucket and passing its reference as a response to the android side instead of passing the actual object itself.

提交回复
热议问题