Renamed asset does not show up when queried by tag
I've renamed a small set of assets through the Media Library UI, expecting that this will change their so-called PublicID, effective immediately...
However, when I query for media by tag, even after waiting for over 10 minutes, I'm still given an old presumably cached JSON response containing their old `public_id` values; case in point: https://res.cloudinary.com/sharkninja/image/list/IZ201EU.json
response:
```json
{
"resources": [
{
"public_id": "SharkNinja/IZ201EU_third",
"version": 1594804791,
"format": "jpg",
"width": 1400,
"height": 1400,
"type": "upload",
"created_at": "2020-07-15T09:19:51Z"
},
{
"public_id": "SharkNinja/IZ201EU_side",
"version": 1594804790,
"format": "jpg",
"width": 1400,
"height": 1400,
"type": "upload",
"created_at": "2020-07-15T09:19:50Z"
},
{
"public_id": "SharkNinja/IZ201EU_front",
"version": 1594804788,
"format": "jpg",
"width": 1400,
"height": 1400,
"type": "upload",
"created_at": "2020-07-15T09:19:48Z"
},
{
"public_id": "SharkNinja/IZ201EU_fourth",
"version": 1594804788,
"format": "jpg",
"width": 1400,
"height": 1400,
"type": "upload",
"created_at": "2020-07-15T09:19:48Z"
},
{
"public_id": "SharkNinja/IZ201EU_fifth",
"version": 1594804787,
"format": "jpg",
"width": 1400,
"height": 1400,
"type": "upload",
"created_at": "2020-07-15T09:19:47Z"
}
],
"updated_at": "2020-07-30T10:33:19Z"
}
```
Which leads to the image gallery widget requesting media that is no longer existing...
How can this be fixed?
-
Update, it appears that I was able to force the issue, by temporarily adding the same tag to a newly uploaded image.
While this solves my immediate problem this is hardly workable in bulk.
0 -
Hi Aditya,
The list file will be cached for sometime. If you want to invalidate it from the CDN you can use the destroy call with invalidate true and than ask for it again. For example in NodeJS:
```
cloudinary.v2.uploader.destroy('tag', {type:"list",invalidate="true"},function(error,result) {console.log(result, error) });
```
Hope that helps,
1 -
Can you please quantify "some time"? Are we talking minutes, hours or days?
0 -
Hi Aditya,
The JSON resource lists have a CDN cache time of about 60 seconds so typically any changes which affect the underlying content of the JSON file (e.g. you added or removed a tagged resource) will take effect in about 60 seconds
The issue in your example is that the rename operation isn't updating the list correctly, and we have a task on our side to resolve that, but in the meantime, Shirly's suggestion of deleting the list itself (causing it to be regenerated when the cache expires) should provide a workaround
Regards,
Stephen1 -
Hi Aditya,
Our dev team fixed this issue and you will now get the updated list when changing the name of the image.
Best,
0
Post is closed for comments.
Comments
5 comments