pythonamazon-web-servicesaws-lambdaamazon-ecr

Why nothing written in AWS Lambda logs?


Originally some AWS Lambda(A) that i made was work well. But When I deploy new ECR Image and apply Lambda A, and then I invoke the lambda; Sometimes, nothing happen!

So, I checked lambda logs every time when occured upper issue. and the logs like below:

2025-07-14T08:51:28.206+09:00 START RequestId: 24e982ca-5161-4f02-82d7-0bd94d289fc5 Version: $LATEST

2025-07-14T08:56:28.255+09:00 2025-07-13T23:56:28.254Z 24e982ca-5161-4f02-82d7-0bd94d289fc5 Task timed out after 300.05 seconds

2025-07-14T08:56:28.255+09:00 END RequestId: 24e982ca-5161-4f02-82d7-0bd94d289fc5

2025-07-14T08:56:28.255+09:00 REPORT RequestId: 24e982ca-5161-4f02-82d7-0bd94d289fc5 Duration: 300048.73 ms Billed Duration: 301192 ms Memory Size: 128 MB Max Memory Used: 119 MB Init Duration: 1191.06 ms

What's wrong with this Lambda?

Memory size is the one of issue?


Solution

  • Regarding the timeout after 300 seconds aka 5 minutes:
    The default timeout for Lambdas is 3 seconds, so I guess you already adjusted this.

    Without any knowledge about the container image you're building/using, I strongly suspect that the container image hits some kind of cold start situation, which exceed the 5 minutes timeout.

    Found answers/explanations for similar cases here and here, although they don't match exactly.

    So what's happening on AWS side when you update the image can be described like this:

    This process takes time - and is generally described as "cold start". See this for a more detailed description in which situations cold starts can be especially annoying. TL;DR: All invocations until the first Lambda instance is running will all be delayed by cold start behavior.

    AWS docs around this topic can be found here. It even describes your exact error messages.

    There are different ways to approach this. You can increase timeout, reduce image size, reduce image startup dependencies, change language, and more. Probably all of them are worth a separate question...
    But hopefully, I was able to explain what you are seeing and get you on the right track.