Reputation: 497
I am trying to push an app to heroku so I need to convert my carrierwave setup to store images to an s3 bucket. I followed the guide on the carrierwave readme but no matter what I do I can't seem to get the images to save to my bucket.
First I added the fog gem.
#carrierwave gemfile
gem "carrierwave"
gem "mini_magick"
gem "fog"
Then created a amazon s3 account and made an IAM user with an administrator policy and generated an access key and secret for that user. I then created a bucket and set the grantee to everyone.
Back in my app I changed the storage to fog in the image_uploader and created an initializer with the following values:
#config/initializers/fog.rb
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'myaccesskeyid',
:aws_secret_access_key => 'mysecretaccesskey',
:region => 'US Standard'
}
config.fog_directory = 'my-bucket'
end
After restarting the server and trying to upload an image I get a broken image with a link like https://my-bucket.s3.amazonaws.com/uploads/image/url/56/inline_content_MOWEFbYOJKSLVM0LeTslBn1l7URjrwAn7w6qLd-kbbU.jpeg
but the bucket remains empty and the image has not been uploaded. I have tried creating different buckets, using my old root key for the aws account but nothing seems to work. I am in Europe using the US region but that shouldn't make a difference. I can't seem to find any errors that would explain what is going wrong but where would I look besides my server log?
EDIT: I tried setting up a google storage bucket and changed the credentials but it still gives a broken image and nothing is uploaded to the bucket.
Upvotes: 1
Views: 500
Reputation: 497
I downgraded my fog version to 1.24.0 and it started working!
gem "fog", '1.24.0'
Upvotes: 2