1
votes

I get an error saying "ActionView::Template::Error (missing required :bucket option)" when I try to use paperclip and s3 for my rails app in production.

My production.rb has:

config.paperclip_defaults = {
  :storage => :s3,
  :s3_credentials => {
    :bucket => ENV['rockywolf'],
    :access_key_id => ENV['dsfa'],
    :secret_access_key => ENV['fdsa']
  }
}

When I run heroku config, I have:

AWS_ACCESS_KEY_ID:          dsfa
AWS_SECRET_ACCESS_KEY:      fdsa
S3_BUCKET_NAME:             rockywolf
bucket:                     rockywolf

Any advice on how to fix this?

2013-12-12T14:44:59.342109+00:00 app[web.1]: ActionView::Template::Error (missing required :bucket option):
2013-12-12T14:44:59.342109+00:00 app[web.1]:     38:         <!-- End image -->
2013-12-12T14:44:59.342109+00:00 app[web.1]:     33:         <!-- Image -->
2013-12-12T14:44:59.342109+00:00 app[web.1]:     34:         <div class="col-md-3">
2013-12-12T14:44:59.342109+00:00 app[web.1]:     35:           <%= image_tag product.avatar.url(:medium), :class => "featurette-image img-responsive", :alt => "#{product.name}" %>
2013-12-12T14:44:59.342109+00:00 app[web.1]:     36: 
2013-12-12T14:44:59.342109+00:00 app[web.1]:     37:         </div>
2013-12-12T14:44:59.342296+00:00 app[web.1]:   app/views/products/latest.html.erb:6:in `_app_views_products_latest_html_erb___978491162299015895_69950414232980'
2013-12-12T14:44:59.342296+00:00 app[web.1]: 
2013-12-12T14:44:59.342109+00:00 app[web.1]: 
2013-12-12T14:44:59.342296+00:00 app[web.1]: 
2013-12-12T14:44:59.342109+00:00 app[web.1]:   app/views/products/latest.html.erb:35:in `block in _app_views_products_latest_html_erb___978491162299015895_69950414232980'
Sharats-MacBook-Pro:rockywolf sharatakasapu$ 
1

1 Answers

4
votes

The env key should be the name of the config.

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']
  }
}