adonisjs / drive-s3

S3 driver for AdonisJS drive
MIT License
21 stars 9 forks source link

AccessControlListNotSupported: The bucket does not allow ACLs #9

Closed dipanjanpanja6 closed 1 year ago

dipanjanpanja6 commented 2 years ago

I'm getting AccessControlListNotSupported, when uploading to s3 using await file.moveToDisk(Key, { name, contentType }, 's3'). aws doc says ACLs are disabled and no longer affect permissions. so for now i'm add this code in config/drive.ts

s3:{
   //@ts-expect-err?
    visibility: undefined,
    ...other config
}

either i missed something in doc or need to add some config for ACLs disable

fd6130 commented 2 years ago

Remove the visibility works for me but the TS compiler keep prompt warning Property 'visibility' is missing in type ....

I think visibility should become optional params since it will cause error when bucket ACLs are disabled.

thetutlage commented 2 years ago

What are the files visibility by default when ACL is disabled?

dipanjanpanja6 commented 2 years ago

@thetutlage im using aws CloudFront with s3, so without cdn link its visibility is private. Here is the bucket policy:

{
    "Version": "2008-10-17",
    "Id": "PolicyForCloudFrontPrivateContent",
    "Statement": [
        {
            "Sid": "1",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <key>"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<bucket_name>/*"
        }
    ]
}

ask me if you need anything 👍