Issue with removing deleted image assets from Sanity CDN cache
21 replies
Last updated: Oct 14, 2024
T
Hi there!
My team deleted some image assets from our Sanity CMS. However, it appears those images are still available from the CDN. When reviewing the
CDN’s caching protocol it looks like assets are cached indefinitely. It is important we remove this asset we removed due to some copywright issues. How can we invalidate the cache for these images so that the Sanity CDN will remove them from cache?
Thanks a bunch!
My team deleted some image assets from our Sanity CMS. However, it appears those images are still available from the CDN. When reviewing the
CDN’s caching protocol it looks like assets are cached indefinitely. It is important we remove this asset we removed due to some copywright issues. How can we invalidate the cache for these images so that the Sanity CDN will remove them from cache?
Thanks a bunch!
Jul 31, 2024, 2:30 PM
C
Are you using the 'media plugin' by chance? A thought -- maybe you've removed the reference to the image from where it was used, but the 'image' itself might still be in your dataset and that might be keeping it in the cache?
The media plugin gives you a view into all the media assets whether they are referenced or not. That might be enough to give the cdn a kick?
The media plugin gives you a view into all the media assets whether they are referenced or not. That might be enough to give the cdn a kick?
Jul 31, 2024, 8:03 PM
T
Great idea to check on that! My team did delete the images from the Media plugin/gallery
Jul 31, 2024, 8:19 PM
đź‘‹ GCP services our asset CDN, so you would try using the method described here to invalidate it yourself.
Jul 31, 2024, 9:06 PM
J
user M
I doubt end users can invalidate cache from GCP just like that. It would entail having authorization to do so, right?Aug 1, 2024, 1:52 PM
T
Yeah shouldn’t deleting an image delete the image from the cache and invalidate it. I would assume that be the way it works. Has anyone else ran into this issue before?
Aug 1, 2024, 2:14 PM
T
Also
user M
, isn’t this the Sanity CDN? How would I have the ability to invalidate Sanity’s cache?Aug 1, 2024, 2:16 PM
C
If it is copyright related concerns in any cache you can probably go that route and google would have to 'respect' that some how. But if you're the one who violated the 'copyright' by putting it in, the 'process' might not allow for that... I'd think you'd have to then have the original rights holder of the image make the request which would just be way more complicated than it is worth.
Aug 1, 2024, 2:43 PM
T
Hey Chris, I don’t think I am following. Are you saying I have to reach out to Google in order to invalidate Sanity’s cache?
My team really needs this image cleared from Sanity’s cache as the images are under copywright.
My team really needs this image cleared from Sanity’s cache as the images are under copywright.
Aug 1, 2024, 8:31 PM
T
Thank you!!
Aug 1, 2024, 9:20 PM
I’m now getting a 404 on both of the image URLs you requested. It may take a bit more time to propagate, but please confirm when you get the chance.
Aug 1, 2024, 11:07 PM
T
Thank you Geoff! I am seeing the 404 on one of the images. But as you said it might take more time to propgate. I will confirm when I see the other image propagate
Aug 1, 2024, 11:17 PM
T
I am still able to access to access this image. https://cdn.sanity.io/images/d8lrla4f/staging/82529b51d9bdf0277ffb6fd7ccc1ce141cd07fec-1024x597.webp?fit=max&auto=format&w=640&q=75
Aug 2, 2024, 5:44 PM
T
Yes, and used an incognito browser
Aug 2, 2024, 5:44 PM
T
Oh shoot I need more coffee
Aug 2, 2024, 5:45 PM
T
It is showing 404 now
Aug 2, 2024, 5:45 PM
T
Thanks team!
Aug 2, 2024, 5:45 PM
L
Hi I am experiencing the same issue. I deleted a PDF via Sanity Studio but the link is still active.
user A
user M
user F
did Sanity support team have to intervene in order to invalidate the cache? Or did you just have to wait for the changes to propagate through the CDN?Oct 14, 2024, 8:20 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.