S3-Uploads
S3-Uploads copied to clipboard
0 (zero) bytes files in s3 after upload
Hi,
Installed and enabled your plugin on WP 4.7.2 multisite install, created new s3 bucket, IAM user.
Tried to upload a file using media library. It showed up in s3 - https://s3.amazonaws.com/mybucket.com/uploads/sites/3/2017/03/15289118_10153975276332327_12359350734570324_o.jpg
But the file is empty, zero bytes..
What could be the problem?
This seem to be resolved by giving full permissions to s3, probably I missed some important bucket permissions. Is there a dock saying which permissions I need?
Also I noticed that when I delete image in WP, original image is not deleted, only 150x150 and 300x300 copies. Is that by design? ( why? )
Just in case someone finds this and does NOT want to give full admin permissions, and does not use the wp-cli tool provided for creating IAM user. You can restrict user to specific bucket by using the following security policy
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:PutObjectAclVersion",
"s3:AbortMultipartUpload",
"s3:ListBucket",
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::bucketname-here"
},
{
"Action": [
"s3:PutObject",
"s3:PutObjectAcl",
"s3:PutObjectAclVersion",
"s3:AbortMultipartUpload",
"s3:ListBucket",
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::bucketname-here/*"
}
]
}
I've also stumbled upon this issue. Changing default acl settings to "private" helped, and "s3:PutObjectAcl" permissions mentioned by @mattpramschufer were unnecessary.
define('S3_UPLOADS_OBJECT_ACL', 'private');
Hope it helps.
Just in case someone finds this and does NOT want to give full admin permissions, and does not use the wp-cli tool provided for creating IAM user. You can restrict user to specific bucket by using the following security policy
"s3:PutObjectAcl", "s3:PutObjectAclVersion",
Thanks @mattpramschufer!
Ran into the same issue, adding these to the IAM role being used by S3-Uploads corrected the issue.
A bit of a gotcha, unfortunately the PHP error logs don't seem to throw any errors for this kind of issue.
I was using CDK, and incorrectly assumed mediaBucket.grantReadWrite(wordpressLambda)
would be enough. Had to add to also add mediaBucket.grantPutAcl(wordpressLambda)
to get the above PutObjectAcl* added to the IAM role.
I've also stumbled upon this issue. Changing default acl settings to "private" helped, and "s3:PutObjectAcl" permissions mentioned by @mattpramschufer were unnecessary.
define('S3_UPLOADS_OBJECT_ACL', 'private');
Hope it helps.
This helped me fix the issue, this was missing from my config.
Thanks @aaronbrighton, grantPutAcl()
was the missing piece for us too!