- Newest
- Most votes
- Most comments
The init phase is limited to 10 seconds, although, after the first 10 seconds we should retry it. The init phase is anything happening outsize the handler. Are you doing anything intensive in there? If you do, I suggest you move it into the handler.
You did not mention how you trigger the function. For example, if you trigger it from SQS, it may be that your visibility timeout is too low, so the function may be triggered more than once. Also, SQS has an At Least once lambda invocation, so by design your function may be invoked twice.
If idempotancy is important for your use case, you may need to implement it into your function by marking tha batch when it is being processed. You can mark it in a DynamoDB table for instancee
I trigger it using AWS EventsBridge - schedule based rules in cron format executed every 5 mins. I checked cloudwatch logs and the multiple entries appear related to init timeout. I see this line in the logs: INIT_REPORT Init Duration: 9995.80 ms Phase: init Status: timeout. I had set overall timeout of 6 mins but the init timeout is happening within 10 secs. Any guidance on what could be causing this?
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
Thanks a ton :) In my local env, I was calling lambda_handler(None,None) at the end of the file and by mistake had pushed this into AWS. So may be this function was getting called - during init phase and then due to this line in my docker file CMD [ "mylambdafucntion.lambda_handler" ].