雾错误:提供了nodename和servname

时间:2012-12-01 01:38:28

标签: ruby-on-rails-3 fog

我基本上为FOG设置了以下right out of the FOG website

  def fog_save_file_for(filename, file) 
# create a connection
connection = Fog::Storage.new({
  :provider                 => 'AWS',
  :aws_access_key_id        => '##',
  :aws_secret_access_key    => '##'
})

directory = connection.directories.get('upload_dir')

# list directories
#p connection.directories

# upload that resume
file = directory.files.create(
  :key    => filename,
  :body   => File.open("cv_uploads/provider_cvs/"+filename),
  :public => true
)
end

在运行时我收到以下错误:

getaddrinfo: nodename nor servname provided, or not known (SocketError)

1 个答案:

答案 0 :(得分:1)

此问题可能是由于使用了错误的区域造成的。 Carrierwave / Fog默认为" us-east-1"这不一定是你正确的地区。要解决此问题,请在AWS上查找您的区域(这不会是像#34;爱尔兰"但是像" eu-west-1这样的区域),然后修改您的配置文件以包含以下内容:

 :region => 'eu-west-1', #or whatever your region is