'Unable to compile Typescript: property 'getObjectAttributes' is missing in type 'AWS.S3'
I trying to use multerS3 and AWS-SDK with typescript, however is not working. "aws-sdk": "^2.1072.0", "multer": "^1.4.4", "multer-s3": "^2.7.8", "@types/multer": "^1.4.4", "@types/multer-s3": "^2.7.8",
acl: 'public-read',
s3,
bucket: `${process.env.AWS_BUCKET}`,
contentType: multerS3.AUTO_CONTENT_TYPE,
key: (req: any, file: any, cb: any) => {
crypto.randomBytes(8, (err, hash) => {
if(err) cb(err);
const fileName = `${hash.toString('hex')}-${file.originalname}`;
cb(null, fileName)
});
}
})```
Problem :
Property 'getObjectAttributes' is missing in type 'AWS.S3' but required in type 'S3'.ts(2741)
s3.d.ts(391, 3): 'getObjectAttributes' is declared here.
index.d.ts(13, 5): The expected type comes from property 's3' which is declared here on type 'Options'
Am I doing something wrong? Basically I follow all the documentation from Amazon and MulterS3 website.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
