getaddrinfo ENOTFOUND api.cloudinary.com
Getting this error while uploading the files
sometimes it works fine and sometimes it don't.
someone please help
-
Hey, thanks for reaching out!
Generally, this error is DNS related.
In order for me to better understand the described error, I would need some additional information.
For instance -- How are you trying to upload the files? Cloud you elaborate on your use case? Are you making use of Cloudinary's SDKs?
- Could you kindly share a specific example of a failed upload attempt (code snippet with specific values)?
- Are you connected via a proxy server?
- Where is your app hosted? Are you using any external platform like Firebase, Google Cloud Functions, etc.?
- Next time you encounter this issue, could you please run the following commands, and let me know what output are you seeing?
dig api.cloudinary.com
dig @8.8.8.8 api.cloudinary.com
Any additional information would be very helpful.
0 -
Hi,
cloudinary.config({cloud_name: "XXXX",api_key: "XXXXX",api_secret: process.env.CLOUDINARY_SECRET});const { CloudinaryStorage } = require('multer-storage-cloudinary');const storage = new CloudinaryStorage({cloudinary: cloudinary, // this is the cloudinary we have configured abovefolder: 'photo-app', // name of folder inside cloudinary where our images will be storedallowedFormats: ['jpeg', 'jpg', 'png'],filename: function (file,options,cb) {let buf = crypto.randomBytes(16);console.log('this is buffer');console.log(buf,'This is buffer');buf = buf.toString('hex');let uniqFileName = file.originalname.replace(/\.jpeg|\.jpg|\.png/ig, '');uniqFileName += buf;console.log(uniqFileName)cb(undefined, uniqFileName );}});
This is code i've been using in nodejs
Currently it is not hosted i'm running it locally0 -
Can you share the asset that you are trying to upload and it reproduces the error?
If security is an issue, please feel free to open a ticket at support@cloudinary.com
0 -
I figured out it's basically DNS error , whenever internet goes down i get this error .
Whats the solution ?
0 -
Hi Yash,
In that case, because the error is local to your environment, the best way to address it is to catch the exception that occurs when your code can't reach the server, then queue it for a retry later (if you have a message queue), or log the details so you can retry it again later.
You may also be able to mitigate this by adjusting the DNS resolution or caching settings on your server or router, but overall, the problem is that your computer can't connect to the API server, so there may still be cases where the upload can't reach us
Regards,
Stephen0
Post is closed for comments.
Comments
5 comments