从 cloudinary 中删除图像不起作用 - Nodejs

Delete Image from cloudinary not working - Nodejs

这是我在下面的实现。我尝试使用 public id 删除图像,但我一直得到

{ result: 'not found' }

配置:

 require("dotenv").config();

 cloudinary.config({
   cloud_name: process.env.CLOUD_NAME,
   api_key: process.env.CLOUD_API_KEY,
   api_secret: process.env.CLOUD_API_SECRET
 });

删除图片函数:

const deleteimage = async () = {
   return await cloudinary.uploader.destroy(
     "folder/mrobompy9ci9xawtmvcv",
     { invalidate: true, resource_type: "raw" },
     function(err, res) {
       if (err) {
         console.log(err);
         return res.status(400).json({
           ok: false,
           menssage: "Error deleting file",
           errors: err
         });
       }
       console.log(res);
     }
   );
 }

尝试将 resource_type: "raw" 更改为 resource_type: "image" 请参阅 link 了解更多 resource_type