I am getting this error while working on a node backend using typescript and this is the function for file upload to aws S3. Im new to using typescript so can anyone help me on this.
import AWS from "aws-sdk";
import multer from "multer";
import multerS3 from "multer-s3";
let S3 = new AWS.S3({
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET
})
const upload = multer({
storage: multerS3({
s3:S3, //error here
bucket: 'bucket-name',
metadata: function (req, file, cb) {
cb(null, { fieldName: file.fieldname });
},
key: function (req, file, cb) {
cb(null, Date.now().toString())
}
})
})
export { upload }