vendredi 20 juillet 2018

Error executing "GetObjectAcl" resulted in a 403 Forbidden Access Denied

I am trying to copy an image from one folder to another one in Amazon S3 through Laravel 5.5 / PHP 7

$s3 = Storage::disk('s3');
$s3->copy('old_path/image.jpg', 'new_path/image.jpg');

And I am getting the error:

Aws \ S3 \ Exception \ S3Exception
Error executing "GetObjectAcl" on "https://mybucket.s3.us-east-2.amazonaws.com/old_path/image.jpg?acl"; AWS HTTP error: Client error: `GET https://mercadocodigo.s3.us-east-2.amazonaws.com/users/3/items/1/1/image.jpg?acl` resulted in a `403 Forbidden` response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>xxx (truncated...) AccessDenied (client): Access Denied - <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>xxx</RequestId><HostId>xxx</HostId></Error>

I've noticed that the query acl was automatically appended to old_path/image.jpg as you can see in the error https://mybucket.s3.us-east-2.amazonaws.com/old_path/image.jpg?acl, what I suspect it is causing the error, because the image is accessible through the URL https://mybucket.s3.us-east-2.amazonaws.com/old_path/image.jpg but it is inaccessible with the ?acl in its end.

Any idea?!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire