Ruby on Rails Thursday, February 27, 2014

Hi, 

I am currently trying to upload images on to Amazon S3 using paperclip for my rails app. The upload seems to work locally, however I receive the following error in production

     ArgumentError (missing required :bucket option):
     app/controllers/meals_controller.rb:34:in `create'


Heres the production.rb file -

config.paperclip_defaults = {
    :storage => :s3,
    :s3_credentials => {
      :bucket => ENV['S3_BUCKET_NAME'],
      :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
      :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
    }
  }

Here are the Gems that are currently running -

ruby ~> 2.0.0
rails ~> 4.0.1
paperclip ~> 4.10
aws-sdk ~> 1.34.1

Thanks in advance

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/35c57752-00b0-46d7-a56d-05b15ac7f286%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

2 comments:

Unknown said...

Same EXACT problem. I've been searching for a solution for like 8 hours straight and can't find anything even remotely useful.

Unknown said...

I figured it out :')

$ heroku config:set S3_BUCKET_NAME=BUCKET_NAME_VALUE

((and make sure it says "S3_BUCKET_NAME" in your production rather than "AWS_BUCKET")):

config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}


$ heroku run rake db:migrate
$ git push heroku master

Post a Comment