Search code examples
amazon-web-servicesimageserverless

AWS Serverless Image Handler: images aren't displayed even though they are generated


I am using the AWS Serverless Image Handler as a CloudFormation to resize my images on my S3 buckets which I distribute via CloudFront. When requesting an object, I generate signed URLs on my backend and use them as a src attribute in my frontend.

Now, while some images are working and getting displayed correctly, some other images aren't:

This is what it looks like in the Frontend

When I open the image in a new tab, strangely I can view it.

Image is displayed in the new tab

Dev Tools gives me a 500-Error, but while the image is visible in a new tab, it can't be an issue by the Serverless Image Handler, could it?

In addition, there's not really a pattern which decides which images will not be displayed. It changes over time and appears random.

What could be the problem here?

Thanks!


Solution

  • I found the answer to this in this thread!:

    https://github.com/aws-solutions/serverless-image-handler/issues/375#issuecomment-1227290911

    tl;dr

    Make sure your "concurrent Lambda executions quota" is large enough (for me was 10, increased to 1000), otherwise if you request multiple images at once, some of them will get dropped out and fail, and then CloudFront will also cache them for a few minutes.

    So the fix is to request an increase of the concurrent Lambda executions quota here: https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html

    Hope this fixes the issue for you as well.