Replies: 1 comment 3 replies
-
@jessetan It is correct that each Deployment will invalidate the browser cache, but it will not invalidate the Edge cache, meaning you're not incurring more Image Optimization costs with each Deployment. I think we need to update the documentation here to clarify which cache. Can you clarify if you are on Vercel, and if yes is Skew Protection toggled on? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What is the documentation issue?
The documentation about Image Optimization with Vercel states that the cache is not invalidated for remote images for a new deployment.
While this may be true and the image remains on the Vercel Edge Network, the default image loader in Next.js appends the deployment id to the query url to the image optimization:
The result is that after every new deployment, a user's browser will see this as new image and will not use it's local cache.
This may be a documentation issue, where the actual implementation is not fully documented, or it may be a bug or feature request, to allow the author to opt out of using the deployment id in the default loader.
A workaround for this is to write a custom loader that does the same as the Next.js default loader, with the exception of adding the deployment id.
Is there any context that might help us understand?
Vercel bills projects for (amongst others) number of edge requests, number of image optimizations and transferred data. If every deployment will cause all visitors to download images again even if they have not been changed, this will create unnecessary charges.
Does the docs page already exist? Please link to it.
https://vercel.com/docs/image-optimization#remote-images
Beta Was this translation helpful? Give feedback.
All reactions