使用Excon :: Errors :: HTTPStatusError导致雾上传失败

时间:2013-02-24 21:51:01

标签: ruby-on-rails-3 carrierwave fog

我无法弄清楚为什么我在使用Fog 1.9.0,rails 3.12& amp; carrierwave

Completed 500 Internal Server Error in 3256ms

Excon::Errors::HTTPStatusError (Expected(200) <=> Actual(0 Unknown)
  request => {:chunk_size=>1048576, :connect_timeout=>60, :headers=>{"User-Agent"=>"fog/1.9.0", "Content-Length"=>217719, "Content-Type"=>"image/jpeg", "x-amz-acl"=>"private", "Cache-Control"=>"max-age=315576000", "Date"=>"Sun, 24 Feb 2013 20:48:15 +0000", "Authorization"=>"REDACTED", "Host"=>"myproject.s3-website-eu-west-1.amazonaws.com:80"}, :idempotent=>true, :instrumentor_name=>"excon", :middlewares=>[Excon::Middleware::Instrumentor, Excon::Middleware::Expects, Excon::Middleware::Mock], :mock=>false, :nonblock=>true, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/tomi/.rvm/gems/ruby-1.9.3-p194/gems/excon-0.18.5/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"myproject.s3-website-eu-west-1.amazonaws.com", :path=>"/uploads%2F2013%2F2013-02-23_photos_e__2-3%2Fphotos%2Fp000000048.jpg", :port=>"80", :query=>nil, :scheme=>"http", :user=>nil, :password=>nil, :family=>0, :body=>#<File:/Users/tomi/git/memo/public/uploads/tmp/20130224-2048-23069-6236/20090101_003.jpg>, :expects=>200, :method=>"PUT", :retries_remaining=>1}
  response => {:body=>"", :headers=>{}, :status=>0, :remote_ip=>"178.236.4.60"}):
  app

当我保存负责上传到s3

的记录时会发生这种情况

我的雾配置

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',                        # required
    :aws_access_key_id      => 'xxxxxx',                        # required
    :aws_secret_access_key  => 'xxxxxx',                        # required
    :region                 => 'eu-west-1',                  # optional, defaults to 'us-east-1'
    #:hosts                  => 's3.example.com',             # optional, defaults to nil
    :endpoint               => 'http://s3-website-eu-west-1.amazonaws.com' # optional, defaults to nil
  }
  config.fog_directory  =  BUCKET_NAME                    # required
  config.fog_public     = false                                   # optional, defaults to true
end

1 个答案:

答案 0 :(得分:1)

Carrierwave自述文件指定您使用1.3.1。我想我也有使用最新雾的问题。这应该工作:

gem "fog", "~> 1.3.1"

https://github.com/jnicklas/carrierwave