You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the readme it is implied, though not explicitly stated, that the config object needs to be passed into multer within another object, e.g. { storage: storage }
However if the config object is passed in without being wrapped in an object itself, nothing untoward happens until an attempt to upload an item to cloudinary is made, in which case no path, url, etc. are returned, and things get broken at that point.
// Config object in my /cloudinary/index.js
const storage = new CloudinaryStorage({
cloudinary: cloudinary,
params: {
folder: 'DBName',
allowedFormats: [
"jpg",
"jpeg",
"png"
]
}
});
// Multer/cloudinary setup in my controller
const multer = require("multer");
const { storage } = require("../cloudinary")
const upload = multer(storage); // No error thrown if the config object is passed in without being in an object, itself
It would be nice to have a check to make sure that the proper format is passed in to the multer instance, and an error be thrown during compile if not. I had to get some sleep before I was able to nail down this issue!
I apologize if this is actually a plain multer issue, rather than a multer-storage-cloudinary issue. Let me know if I need to post there instead.
The text was updated successfully, but these errors were encountered:
In the readme it is implied, though not explicitly stated, that the config object needs to be passed into multer within another object, e.g.
{ storage: storage }
However if the config object is passed in without being wrapped in an object itself, nothing untoward happens until an attempt to upload an item to cloudinary is made, in which case no path, url, etc. are returned, and things get broken at that point.
It would be nice to have a check to make sure that the proper format is passed in to the multer instance, and an error be thrown during compile if not. I had to get some sleep before I was able to nail down this issue!
I apologize if this is actually a plain multer issue, rather than a multer-storage-cloudinary issue. Let me know if I need to post there instead.
The text was updated successfully, but these errors were encountered: