-
-
Notifications
You must be signed in to change notification settings - Fork 463
503 when using image optimization #840
Comments
If you check the image lambda output, just checking, are the node_modules and sharp correctly copied there? I had prebuilt modules for Lambda so it should just copy those. Also make sure the function is running Node 12.x as that is what is mentioned in the Sharp installation page. (If this fixes, will update the docs to mention it) |
@dphang +1 for this issue as well. Config is basic as follows:
|
Yea, this is strange, for some reason the |
I think when running it locally, it copies the vendor libs correctly, but when doing an npm publish, it seems to exclude certain files. I think if we update the |
I think it is because the |
It should be fixed now in |
@dphang I am deploying with the new alpha as we speak, will report back |
@dphang I have same issue, but only works on svg files, my png file has 503 error and cant load all <Image src="/main1-2.png" width={582} height={287} loading="lazy" />
<Image src="/logo.svg" width={24} height={24} loading="lazy" /> |
@snowjang24 thanks for reporting. I'll leave this open for a few days so I can easily track any bugs. Could you please provide more details like Next.js version, Serverless-next.js version? As mentioned above I did push a couple of fixes with 1.19.0-alpha.19 so the optimizer should work fine now. For SVG files, it doesn't go through the Sharp optimization at all since it doesn't need to (it's a vector type) (see: https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/libs/lambda-at-edge/src/images/imageOptimizer.ts#L264-L267) If you are optimizing What kind of URL are you optimizing? Is it absolute URL or relative URL (in public folder?) What do CloudWatch logs say about the 503 errors? 503 is very generic so it will be more helpful to have more details. Thanks! |
My dependencies is
svg files and png files in the same directory, like I tried to optimize the relative URL. I saw your comment and upgrade to alpha.19 and now it works well for all png and svg ....😭 Thanks for your kind comment |
@dphang 👍 🥇 |
Unsure if this is a specific to this lib or to Next.js in general, but it seems sometimes the conversions fail and then the server returns a 503 for the image every time after that point. |
@jonahallibone not sure what's going on there, please post more details such as CloudWatch logs. |
Thanks, @dphang! Working now. Any suggestions on how we can stop images from being resized on every deployment of our apps? Looks like the |
@kylekirkby yes, the entire cache is invalidated by default, which does include the images path. Please take a look at CloudFront paths section: https://github.com/serverless-nextjs/serverless-next.js#custom-cloudfront-configuration if you would like to specify exact paths. Note that if you do this and exclude all images, if you update an image of the same name, you'll have to ensure you invalidate the cache yourself for that specific file (either manually or using the AWS SDK), otherwise users may see the old image. |
Closing since there were no additional reported issues. |
Hey I'm getting a 401 on my images on production: Next - 10.2.3 Any idea? |
Hi there,
Is your feature request related to a problem? Please describe.
Still, we check
@sls-next/[email protected]
and for now we get 503 on images when we provide an url for an image for a specific listed domain. We get the same result for images located under/public
We setup
next.config.js
with the following:For:
On s3 we see yet no file under
_next/images
Describe the solution you'd like
That is create the optimized images in s3 under
_next/images
Additional
We also found this in cloudwatch logs.
A.
The text was updated successfully, but these errors were encountered: