Cloudinary 批量图片上传 Node.js ETIMEDOUT 错误

Cloudinary bulk image upload in Node.js ETIMEDOUT error

所以我试图在 Node.js 中的一个小 JavaScript 脚本中将大量图像上传到 cloudinary,但是在多次上传之后,我收到此错误:

Error: connect ETIMEDOUT 52.200.235.1:443
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)

我已将我的代码转换为最简单的示例,但我仍然遇到错误。

fs.readdir(".", (err, files) => {
 files.forEach(fileName => {
  cloudinary.v2.uploader.upload(
  fileName,
   { folder: "test4" },
   (err, fileResponse) => {
     if (err) throw err;
   }
  );
 });
});

我尝试添加一个超时参数{timeout:60000},建议here,但它没有用,而且我在官方文档中找不到这个属性。还有其他人遇到这个问题吗?

我通过延迟上传之间的时间解决了这个问题。这将防止 ETIMEDOUT 错误。