Rails Paperclip: missing required :bucket option

自闭症网瘾萝莉.ら 提交于 2019-12-11 15:03:51

问题


I've got Heroku working fine with paperclip, but I'm getting this error when I move the app over to a linux box, the logs show that imagemagick processing finishes and then it fails on upload:

ArgumentError (missing required :bucket option):

My application.yml includes:

S3_BUCKET_NAME: "bucket"
AWS_ACCESS_KEY_ID: "key"
AWS_SECRET_ACCESS_KEY: "secret"

I've doubled-checked that all of that info is correct. production.rb includes:

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

I've reset the server and redeployed to reload the initializers. Is there a way to see ENV variables in rails c on a linux box to see if they're set correctly? I know on heroku you can just do heroku config. I suspect this may be due to my lack of understanding of rails ENV vars


回答1:


I was missing gem 'figaro' in my production env, so none of the ENV variables were being set.



来源:https://stackoverflow.com/questions/23108589/rails-paperclip-missing-required-bucket-option

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!