I’m using Cloudinary with my node.js project…
The issue is cloudinary.config is not reading data from .env file, I have to type them directly!
JavaScript
x
17
17
1
const cloudinary = require("cloudinary");
2
3
cloudinary.config({
4
cloud_name: process.env.CLOUD_NAME,
5
api_key: process.env.CLOUD_API_KEY,
6
api_secret: process.env.CLOUD_API_SECRET,
7
});
8
9
cloudinary.v2.uploader.upload(
10
file.tempFilePath,
11
{ folder: "test" },
12
async(err, result) => {
13
if(err) throw err;
14
console.log(result);
15
}
16
);
17
I’ll be thankful if anyone can help 🙏🏻
Advertisement
Answer
Issue is solved with adding require("dotenv").config();
to the beginning of the same file which contains cloudinary.config