Whenever I try to delete an object with the Javascript SDK, I get an error saying access denied. However, I can upload files correctly. Can someone help me with this?
My policies for the bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::twitter-clone-image-storage-zrs/*"
}
]
}
My function for deleting files:
const s3 = new S3({
region,
accessKeyId,
secretAccessKey,
});
export const deleteFile = (picture_key) => {
const params = {
Bucket: bucketName,
Key: picture_key,
};
return s3.deleteObject(params).promise();
};