Carrierwave, Excon::Errors::MovedPermanently in RegistrationsController#update error

Я пытался заставить Carrwave работать с amazon s3. вместо

storage :s3

у меня есть

storage :fog

изменение его на хранилище: s3 дает немедленную ошибку

https://stackoverflow.com/questions/10629827/carrierwave-cant-convert-nil-into-string-typeerror-when -using-s3

, поэтому я изменил его на хранилище :fog, как сказано в rdoc ниже.

http://rubydoc.info/gems/carrierwave/frames

однако, когда я пытаюсь загрузить изображение, я получаю эту сумасшедшую ошибку. Я тоже использую devise gem.

моя полная трассировка стека

Excon::Errors::MovedPermanently in RegistrationsController#update

Excon::Errors::MovedPermanently (Expected(200) <=> Actual(301 Moved Permanently)
  request => {:connect_timeout=>60, :headers=>{"Content-Length"=>95472, "Content-Type"=>"image/jpeg", "x-amz-acl"=>"private", "Cache-Control"=>"max-age=315576000", "Date"=>"Thu, 17 May 2012 05:28:55 +0000", "Authorization"=>"AWS AKIAIN6SC3YSGBSUKV4Q:kZOG9mG01jYn48ImFMYbgxAAQRk=", "Host"=>"user.a.777.s3-eu-west-1.amazonaws.com:443"}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/sasha/.rvm/gems/ruby-1.9.3-p125/gems/excon-0.13.4/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"user.a.777.s3-eu-west-1.amazonaws.com", :path=>"/uploads%2Fuser%2Fimage%2F59%2Fidea.jpg", :port=>"443", :query=>nil, :scheme=>"https", :body=>#, :expects=>200, :idempotent=>true, :method=>"PUT"}
  response => #\nPermanentRedirectThe bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.F5F5AF888E837622user.a.777IShK3GIthzCQysLOKXnR+ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82s3.amazonaws.com", @headers={"x-amz-request-id"=>"F5F5AF888E837622", "x-amz-id-2"=>"IShK3GIthzCQysLOKXnR+ijJiHmMuUtXBOpFxQM4uCvJgkEHfmFn43LL4oWmpT82", "Content-Type"=>"application/xml", "Transfer-Encoding"=>"chunked", "Date"=>"Thu, 17 May 2012 05:29:00 GMT", "Connection"=>"close", "Server"=>"AmazonS3"}, @status=301>):
  app/controllers/registrations_controller.rb:30:in `update'

я даже не знаю, что это значит.

в моих инициализаторах/carrierwave.rb у меня есть..

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',       # required
    :aws_access_key_id      => 'somekey',       # required
    :aws_secret_access_key  => 'secretkey',       # required
    :region                 => 'eu-west-1'  # optional, defaults to 'us-east-1'
  }
  config.fog_directory  = 'bucket.name'                     # required
  #config.fog_host       = 'https://s3.amazonaws.com'            # optional, defaults to nil
  config.fog_public     = false                                   # optional, defaults to true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}  # optional, defaults to {}
end

и в моем файле загрузки есть

  #storage :s3
  storage :fog
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

в моем файле гема есть

gem 'carrierwave'
gem 'thin'
gem 'fog'

когда я загружаю свой сервер, вместо webrick, он также использует тонкий в разработке.

мои настройки неверны? помощь будет высоко оценена! я очень застрял в этой проблеме с несущей волной/s3

7
задан Community 23 May 2017 в 11:53
поделиться