message: "Invalid Signature***********************************. String to sign
im using the mern stack and i already have used cloudinary , everything was fine till deploy of backend of render.com and front end on netlify
.i get as error :
message: "Invalid Signature 5a70a668aa00331f394e11318f26963d3fea6a4a. String to sign - 'folder=ZIWIBook/users/6419fea409c478369e7fb094/posts_photos/×tamp=1680529703'.",
i didnt understand what's wrong in the implimentation
const cloudinary = require("cloudinary");
cloudinary.config({
cloud_name: process.env.CLOUD_NAME,
api_key: process.env.API_KEY,
api_secret: process.env.API_SECRET,
});
uploadToCloudinary : async (file, path) => {
return new Promise((resolve, reject) => {
if (file) {
cloudinary.v2.uploader
.upload_stream({ folder: path }, (err, res) => {
if (err) {
console.log("🚀 ~ file: cloudinary.js:32 ~ .upload_stream ~ err:", err)
reject(err);
} else {
console.log(`Upload succeed: ${res}`);
resolve(res);
}
})
.end(file);
}
});
},
// delete image from cloudinary
removeFromCloudinary: async (public_id) => {
await cloudinary.uploader.destroy(public_id, function (error, result) {
console.log("🚀 ~ file: cloudinary.js:28 ~ result", result)
console.log("🚀 ~ file: cloudinary.js:28 ~ error", error)
});
},
// get images from cloudinary
getImages : async (path, max, sort) => {
return new Promise((resolve, reject) => {
cloudinary.v2.search
.expression(`${path}`)
.sort_by('created_at', `${sort}`)
.max_results(max)
.execute()
.then((res) => {
resolve(res);
})
.catch((err) => {
reject(err);
});
});
},
};
Comments
-
Hi @mohamed,
Thanks for your post.
I see that there is no folder by the name of 6419fea409c478369e7fb094 in your cloud.
folder=ZIWIBook/users/6419fea409c478369e7fb094/posts_photos/
Can you please check the same?
Thanks
Sree
0