Rails FOG:以下键无效:: scheme,:host

时间:2013-10-08 12:39:10

标签: ruby-on-rails ruby amazon-web-services amazon-s3 fog

使用FOG和AWS时,我突然发现以下错误:

The following keys are invalid: :scheme, :host
Expected(200) <=> Actual(403 Forbidden)

执行捆绑更新后发生此错误。我突然意识不到它出了什么问题。

fog_connection = Fog::Storage.new({:provider => 'AWS',:aws_access_key_id => CUBE_CONF['aws']['access_key'],:aws_secret_access_key => CUBE_CONF['aws']['secret_key'],:region => 'eu-west-1'})

  puts "VideoEntryPandaWorker: established connection with S3"
  # setting the directory
  fog_directory = fog_connection.directories.new(:key => CUBE_CONF['panda']['s3_bucket'])
  puts "VideoEntryPandaWorker: fetched directories from #{CUBE_CONF['panda']['s3_bucket']}"

  # uploading the file
  puts "VideoEntryPandaWorker: creating fog file with src: #{video_entry.video_file.current_path}"
  file = fog_directory.files.new({
                                 :key    => video_entry.video_name,
                                 :body   => File.open(video_entry.video_file.current_path),
                                 :public => true
                             })
  file.save
  puts "VideoEntryPandaWorker: S3 url #{file.public_url}"

也许有人知道出了什么问题?

1 个答案:

答案 0 :(得分:1)

我自己经历过这个,我正在运行Fog 1.11.1并升级到1.15.0为我解决了这个问题。