node.js - 尝试删除 cloudinary 上的非空目录时,Nodejs 应用程序崩溃
问题描述
当我尝试使用我的 API(用 nodejs 编写)删除 Cloudinary 上的目录时,我收到目录不为空(正常)并且应用程序崩溃并且我需要重新启动它的错误。这是错误:
{ message: 'Folder is not empty', http_code: 400 } undefined
{"error":{"request_options":{"protocol":"https:","slashes":true,"auth":"281316816918183:CDb7LmvgBfhnVABQsG9Oks4u0vM","host":"api.cloudinary.com","port":null,"hostname":"api.cloudinary.com","hash":null,"search":null,"query":null,"pathname":"/v1_1/dgreyehwz/folders/9ea364f98672f22279ec99f315c11087/images/aaaaaa","path":"/v1_1/dgreyehwz/folders/9ea364f98672f22279ec99f315c11087/images/aaaaaa","href":"https://api.cloudinary.com/v1_1/dgreyehwz/folders/9ea364f98672f22279ec99f315c11087/images/aaaaaa","method":"DELETE","headers":{"Content-Type":"application/x-www-form-urlencoded","User-Agent":"CloudinaryNodeJS/1.23.0","Content-Length":0}},"query_params":"","error":{"message":"Folder is not empty","http_code":400}},"level":"error","message":"uncaughtException: (no error message)\n No stack trace","exception":true,"date":"Sun Nov 08 2020 17:42:02 GMT+0200 (Χειμερινή ώρα Ανατολικής Ευρώπης)","process":{"pid":2272,"uid":null,"gid":null,"cwd":"J:\\Projects\\NodeJS\\Development\\smartSignageDev","execPath":"C:\\Program Files\\nodejs\\node.exe","version":"v14.15.0","argv":["C:\\Program Files\\nodejs\\node.exe","J:\\Projects\\NodeJS\\Development\\smartSignageDev\\index.js"],"memoryUsage":{"rss":76529664,"heapTotal":61935616,"heapUsed":36817504,"external":21319141,"arrayBuffers":19733004}},"os":{"loadavg":[0,0,0],"uptime":1854},"trace":[]}
[nodemon] app crashed - waiting for file changes before starting...
我用来删除 Cloudinary 目录的代码是:
const cloudinary = require('cloudinary').v2;
cloudinary.api.delete_folder(req.query.folder, function (error, result) {
console.log(error, result);
那个部分
{ message: 'Folder is not empty', http_code: 400 } undefined
是 Cloudinary API 为我的删除请求返回的内容。
我正在使用最新版本的 nodejs 和 Cloudinary Node.js SDK。
有没有人遇到过类似的事情,或者现在这个错误意味着什么?
解决方案
推荐阅读
- javascript - 如何将日期格式化为今天的日期,例如上午 8:00 或晚上 9:00?时刻JS
- c# - 具有特定文化的 C# DisplayAttribute.GetName
- node.js - 设置passenger_nodejs在Nginx服务器中不起作用
- bash - 从 bash 函数调用时,`kubectl` 失败
- python - Pandas Pivot 表并保留两列作为组合标识符
- excel - Excel VBA Formulas to populate until last row , not working for VERY LAST row
- arrays - 如何在匹配后从字节数组中获取接下来的 2 个字节
- stripe-payments - 条纹支付 - 将篮子价格传递给 php 中的 checkout_session
- python - 如何将一个列表中的嵌套字典值附加到另一个列表中?
- laravel - 当我更改连接状态时,LiveWire 离线状态不起作用