wink
wink copied to clipboard
S3 Filesystem Not Working
I have an s3 bucket successfully configured for my app. It is working for all the non-wink parts of my application.
I've added the following items to my .env:
WINK_STORAGE_DISK=s3
WINK_STORAGE_PATH=wink
However, when I try to upload an image I get the following error:
Error executing "PutObject" on "https://my-bucket.s3.us-west-1.amazonaws.com/wink/mJBwl4ixQzI9qcsLEttzghNapLxaFrquST74I6MQ.jpeg"; AWS HTTP error: Client error: PUT https://my-bucket.s3.us-west-1.amazonaws.com/wink/mJBwl4ixQzI9qcsLEttzghNapLxaFrquST74I6MQ.jpegresulted in a403 Forbidden response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>7A693D (truncated...) AccessDenied (client): Access Denied - <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>7A693D29C79D3BDF</RequestId><HostId>JQEG2o5QcFxqq8oIVQkaGfDJcbBRKojgCmSNFXl0A6k2PlSLadOqVdXNyT4uxmxihXNYxHv9S/E=</HostId></Error>
hmm we use it on blog.laravel.com and it seems to be working fine for us. Are you sure you are on the latest Wink?
hmm we use it on blog.laravel.com and it seems to be working fine for us. Are you sure you are on the latest Wink?
Yep, I just installed it 2 days ago, so I must be on the latest. My S3 policy allows the authenticated user I created in IAM to have access to all S3 actions. Again, those credentials are working in the non-wink aspects of the app. In case this is helpful, here is my S3 bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<my-user>"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-bucket/*",
"arn:aws:s3:::my-bucket"
]
},
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
@intellow I had the same issue and had to uncheck those in my bucket config :
But I don't know if it is a good practice. 😨
Hope it helps!
(So my problem wasn't Wink related, i had the same error when trying to upload files from a controller)
I'm having the same issue as @intellow. @opmvpc Your solution worked for me but I'm curios if this is the best/safest way to handle this.
did anyone solve this without changing the public option?
I'm running into this also but I am not able to fix it by making the bucket public.
I ended up unchecking every option in the "Block public access" section and I also added the following policy so that Wink could read and write to the bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Public",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::BUCKET_NAME/*"
}
]
}
It seems S3 has had some updates, to get Wink to be able to upload images I needed to change the owner-enforced property to owner-preferred and "restore ACLs"

my policy remains :
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::preview.aeroquote.com/*"
}
]
}
In my case, even after modifying bucket permissions, I kept getting the error:
Found 1 error while validating the input provided for the GetObject operation: [Key] expected string length to be >= 1, but found string length of 0
Slightly modifying the upload function in ImageUploadsController seemed to fix the issue. Here's the modification:
public function upload()
{
$path = Storage::disk(config('wink.storage_disk'))->put(config('wink.storage_path'), request()->image);
return response()->json([
'url' => Storage::disk(config('wink.storage_disk'))->url($path),
]);
}