Lambda functions bring with them some new limitations that we need to handle as part of the overall monitoring, for example - a limited amount of memory and time, according to our configuration.

Being aware of such issues is crucial, so let’s have an example of a timeout issue to understand how it looks like.

To create a timeout on our store, let’s increase the number of items in stock from 4 to 17 by running update_db.py script in the backend folder:

python update_db.py 17 <REGION>

Make sure to use the same region as before. Let’s revisit our retail store now. We can see that the loader is stuck again, but why?

Let’s get back again to to catalog-shop-dev-get-items to understand what happened:


To get more details, let’s click in the request ID to find out more details in the trace, and switch to the timeline view:


We can easily identify that we are calling an API over and over again, to fetch images for every item in our catalog. This is not a best practice, especially when our catalog can grow to thousands of items.

Possible solutions for this issue can be:

  1. Increasing the timeout duration, from 1 second to more. This can only be a temporary fix, and not the right solution.
  2. Offloading the images lookup into a background task that can run periodically in batches of items.
  3. Parallelizing the images lookup - can be very costly in network and CPU.