-
Notifications
You must be signed in to change notification settings - Fork 34
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
4.7MB PNG crashes (both with & without transformations) #56
Comments
@bs-thomas The issue is probably because pngs are passed through |
Thanks for your assistance @Mosnar. After some investigation, I noticed that it was because I have tweaked the max image size from: To: The interesting thing here is, it's not because of PNGQuant at all. I think your tweak was good, but let's take a look at my log below (which I didn't notice earlier).
It seems to me that it was failing because:
This brings up a very interesting question. @Mosnar Regardless of PNGQuant implementations, the current serverless-sharp implementation would crash if the file size is big, because it would hit the response payload cap at Lambda 6MB, am I correct? If so, any thoughts about what could be done? (I actually have clients who does art auctions, and they could upload images as big as 30MBs!) |
Interesting! Thanks for digging into it! I never realized such a limitation existed. It sounds like we'll need to cache optimized images that are too large to serve from lambda in S3 and 301 redirect to the result in either a public S3 directory, signed URL, or CDN in front of that S3 bucket. What do you think? |
@Mosnar Yes indeed I'm also thinking something along those lines. The one thing I haven't had a chance to verify is if I do an I found this article which does something very similar. While there is sample code, there is no sample github repo. Assuming that we have this image file in the bucket: I think the flow can go something like this:
Does the above make logical sense to you? I'm just imaging things, not sure how well it works. |
I have this weird issue. It could be related to Sharp, but I was wondering if there could be better and more performant configuration set for this library. I'm scratching my head off as I did a few comparisons, and still not understanding why it has to crash.
Here you can see the two scenarios:
(1) https://codebase-images-local.beam.style/public-image/test-big.jpg
WORKS! Automatically resizes to w=2560 (my settings.yml configured at MAX_IMAGE_WIDTH: 2560)
(2) https://codebase-images-local.beam.style/public-image/test-big-png.png
CRASHES! 502 Internal server error. No idea why. Even when I set timeout: 10, memorySize: 3000 <-- Pretty high settings already.
Here are my serverless.com logs for this invocation (scenario 2):
In conclusion, 33.40MB JPG can load without issues (even with transformations).
But, a 4.74 PNG crashes.
Does anyone have any ideas on this?
The text was updated successfully, but these errors were encountered: