"The converted image is too large to return." for large JPG images
See original GitHub issueDescribe the bug
I’m storing multiple JPG images in my S3 bucket (from 1-16MB). When I try to request some with the Serverless Image Handler only a few are returned when specifying no edits (requesting the original image). For images that are over 5MB file size I’m getting the following error:
{ "status": "413", "code": "TooLargeImageException", "message": "The converted image is too large to return." }
To Reproduce Upload multiple JPG images to the S3 bucket with a file size between 1 and 10MB. Then try to request the images with the Serverless Image Handler without specifying any edits, so that the original image is returned.
Expected behavior Returning the original image from the S3 bucket.
Please complete the following information about the solution:
- Version: v5.1.0
- Region: eu-central-1
- Was the solution modified from the version published on this repository? No
- If the answer to the previous question was yes, are the changes available on GitHub?
- Have you checked your service quotas for the sevices this solution uses? Yes
- Were there any errors in the CloudWatch Logs? The same error as mentioned above is in the CloudWatch log.
Additional context
If I’m adding a width and height with both 0 to the request URL the original image is returned without any problems. Like this: https://images.mydomain.com/0x0/my-image.jpg
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@marco910 Handling the images from S3 buckets would be a good option, and we also put this one into our backlog item so that we can handle the images larger than Lambda limit.
@marco910 Thanks for your feedback. By default, we don’t return the original image when any failure happens. Instead, we return the error message. Therefore, if edited images or original images without any edits are larger than 6MB, it returns
TooLargeImageException
error; inside the Lambda function, it returns the image binary with base64 encoded, so the return size would be bigger than actual image size.If you put
0x0
, it will not resize your image, but it will useinside
asfit
value, so there would be a chance that the returned images are smaller than the original size.