Destroy returning "not found"
I have this code that's supposed to delete an image but it keeps returning not found.
static cloudinaryRemoveResourceMethod = async (public_id) => {What can I do to fix this?
try {
const result = await cloudinary.v2.uploader.destroy(public_id);
console.log(result, 0)
return result;
} catch (error) {
return null;
}
};
-
Hi Hamzat.
My name's Danny, and I'm one of the Developer Support engineers here on Cloudinary's Customer Success team. I've had a look at our logs and see a number of successful destroy requests. Could you please provide me with the public_id of an asset that claims not to be found, as well as the full JSON response that is returned?
If you're conscious of posting these details publicly, you're welcome to submit a support ticket privately instead.
Looking forward to hearing back from you!
-Danny0 -
Hello Danny, thank you very much for your response. The public_id of the asset is zrcrhjndn7s74uogd0to and the full JSON response that is returned is
{ result: 'not found' }
0 -
I have been able to get it working. I needed to supply the right 'resource_type' parameter in the delete request. Thanks.
0 -
Hi Hamzat,
Thanks for providing the public_id.
When using the destroy method via the SDK, by default we look for an image reousrce_type, since this resource is a video, you would need to include "resource_type" set to "video" in the request as explained here: https://cloudinary.com/documentation/image_upload_api_reference#destroy_optional_parameters
For now, I see that you managed to destroy this video.
Please let us know if you need any further assistance.Thanks,
Michal0
Post is closed for comments.
Comments
4 comments