-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Http response code: 413 #193
Comments
@vitalinfo I'm sorry for your inconvenience. We will review the workaround or solution for this issue. |
@beomseoklee image size is 693Kb |
@vitalinfo Can you share the original image if you don't mind so that I can test exactly on the same page with you? |
@beomseoklee of corse, edits config:
|
@vitalinfo Oh, you increased the size of the image, and I can see that the output of the image became around 8MB with your edits. That's why you get the 413 error. The workaround can be put the output image to an Amazon S3 bucket, and load the image from the bucket. We will think about the best way so that everyone would be happy. Once again, I'm sorry for your inconvenience. |
@beomseoklee thanks, will be great to have something like |
The fallback image would be related to #137 , so please let us know your opinion for this one as well so that we can think of the best way for everyone. |
@beomseoklee I tried to do add new attribute to the params, like
and return origin image, if |
@beomseoklee ping |
@vitalinfo You are right. The error is generated by AWS Lambda itself, so it's hard to catch the error. The best way is to check the payload size, and if it's too big, then you can return fallback image before returning the result. |
@beomseoklee do you mean |
@vitalinfo yes, or you can calculate |
@beomseoklee Thanks I think we can close the issue |
@beomseoklee
it crashed with 413 error |
@vitalinfo 413 error is related to AWS Lambda's limit. AWS Lambda's invocation payload limit is 6MB, so if the payload is larger than 6MB, it will throw 413 error. You can refer to AWS Lambda limits documentation. For this issue, you cannot catch in the source code. Therefore, you might need to check the payload size first, and then when the payload is more than 6MB, you might need to put the image into Amazon S3 bucket, and return the new URL. This issue is in our backload, so we are planning to implement this one at the next release. |
HI @beomseoklee , looks like problem is much trickier than just check payload size jpg resized successfully, but png doesn't |
I have the same issue but in my case, the problem is with png file 4.3MB which is lower than the limit |
Thanks for waiting. We've released v5.1.0 to mitigate this issue. The new version will throw an proper error message once your images exceed the Lambda limit. @vitalinfo @demsey2 since we are using API Gateway Lambda proxy, we are encoding the image binary which causes bigger payload than the original image size. That's why you've faced an issue with images lower than the Lambda limit. |
I'm having 2 weeks conversation with AWS support, but without any results, hope somebody here will help me figure out what is going on.
Initial problem: for some images I've receive
Internal server error
with[ERROR] [1583405456446] LAMBDA_RUNTIME Failed to post handler success response. Http response code: 413.
on CloudWatch.But, also I found today, that behaviour is much more odd, that I thought 2 weeks ago.
I have an image https://d3mnb0wkum09n0.cloudfront.net/eyJidWNrZXQiOiJjbGFzc3RhZy1zdGFnaW5nIiwia2V5Ijoic3RvcmUvZWJjSjhSOGpDSE04REpjVyIsImVkaXRzIjp7InJlc2l6ZSI6eyJ3aWR0aCI6MjA0OCwiaGVpZ2h0IjoyMDQ4LCJmaXQiOiJjb250YWluIn19fQ==
this link opens for Chrome, Firefox, Opera browsers (on different devices), but doesn't for Safari.
Looks like this image has been processed by CloudFormation (main question how?, because now I receive 413) and saved on CloudFront. But for some browsers it receives from the CloudFront, but for Safari it tries to proceed it again.
Of course main goal to fix 413 error, or at least found any workaround.
I'm using latest template https://s3.amazonaws.com/solutions-reference/serverless-image-handler/latest/serverless-image-handler.template
Any thoughts? Will be very appreciate for any ideas.
The text was updated successfully, but these errors were encountered: