aws lambda function triggering multiple times for a single event

前端 未结 4 1214
北恋
北恋 2020-12-13 18:19

I am using aws lambda function to convert uploaded wav file in a bucket to mp3 format and later move file to another bucket. It is working correctly. But there\'s a problem

4条回答
  •  死守一世寂寞
    2020-12-13 19:17

    Short version: Try increasing timeout setting in your lambda function configuration.

    Long version:

    I guess you are running into the lambda function being timed out here.

    S3 events are asynchronous in nature and lambda function listening to S3 events is retried atleast 3 times before that event is rejected. You mentioned your lambda function is executed only once (with no error) during smaller sized upload upon which you do conversion and re-upload. There is a possibility that the time required for conversion and re-upload from your code is greater than the timeout setting of your lambda function.

    Therefore, you might want to try increasing the timeout setting in your lambda function configuration.

    By the way, one way to confirm that your lambda function is invoked multiple times is to look into cloudwatch logs for the event id (67fe6073-e19c-11e5-1111-6bqw43hkbea3) occurrence -

    START RequestId: 67jh48x4-abcd-11e5-1111-6bqw43hkbea3 Version: $LATEST
    

    This event id represents a specific event for which lambda was invoked and should be same for all lambda executions that are responsible for the same S3 event.

    Also, you can look for execution time (Duration) in the following log line that marks end of one lambda execution -

    REPORT RequestId: 67jh48x4-abcd-11e5-1111-6bqw43hkbea3  Duration: 244.10 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 20 MB
    

    If not a solution, it will at least give you some room to debug in right direction. Let me know how it goes.

提交回复
热议问题