Open moayaan1911 opened 7 months ago
https://github.com/moayaan1911/backend-mastery
Here is my repo
Hey, I encountered a similar issue as well. The problem arose due to a configuration error in my Cloudinary configuration setup. After addressing the issue by adjusting my Cloudinary settings, my problem was resolved. I suggest reviewing your Cloudinary configuration to ensure it is properly configured.
But my images are not getting stores in local public folder either..
That can be because of fs.unlinkSync(localFilePath)
used in Cloudinary.js file, try removing this line from the file.
The problem is because your dotenv file is not configured properly. To check this in cloudinary upload function do a console.log(process.env.CLOUDINARY_SECRET_KEY) ( whatever name you have given ). If you are getting null in terminal, then below configuration will work. First close the server manually, nodemon restarting wont work. Then in your index.js file in project root directory write this instead
dotenv.config({
path: './.env'
})
And in package.json write this script
"scripts": {
"dev": "nodemon -r dotenv/config --experimental-json-modules src/index.js"
},
Now restart your server manually not through nodemon.
try after re-select the file in postman. It happens sometimes.
I also encountered this issue that my images were not getting stored in the public folder but removing all fields from Postman and re-entering the fields in form data worked for me
Try it once
I noticed that in my public folder the images I am sending from postman is NOT GETTING stored, I tried debugging it but couldn't find the solution