首页 > 解决方案 > 尝试删除 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。

有没有人遇到过类似的事情,或者现在这个错误意味着什么?

标签: node.jscloudinary

解决方案


推荐阅读