Search code examples
javascriptnode.jscloudinary

Cloudinary bulk image upload in Node.js ETIMEDOUT error


So I'm trying to upload a bulk of images to cloudinary in a small JavaScript script in Node.js but after a number of uploads, I get this error:

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)

I've transformed my code into the simplest possible example and I still do get the error.

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

I have tried adding a timeout parameter {timeout:60000} which was suggested here, but it didn't work and also I couldn't find this property in the official docs. Anyone else having this issue?


Solution

  • I solved this using by delaying time in between uploads. This would prevent the ETIMEDOUT error.