rails + carrierwave + fog + S3 socket error
Asked Answered
C

1

16

I'm having this problem trying to use S3 services with fog and the Jquery File Upload (https://github.com/blueimp/jQuery-File-Upload)

The error

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

This occur when i try to call "save" method in the controller. I'm setting carrierwave as follow:

config/initializers/carrierwave.rb

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS', 
    :aws_access_key_id      => 'access_key_here', 
    :aws_secret_access_key  => 'secret_key_here', 
    :region                 => 'eu-east-1'
  }
  config.fog_directory  = 'folder_name_here'
  config.fog_public     = false 
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
  config.storage = :fog
end

and my uploader just the "config.storage :fog" and the "store_dir" Now, I have created my bucket already.

Am i missing some configuration? It doesn't even work on my dev environment.

Please any help. Thanks in advance.

Chigetai answered 23/8, 2012 at 22:29 Comment(1)
Im experiencing this same issue Howeever Ive double checked my region for my bucket is Ireland so set region to eu-west-1 but get this error in log on CREATE Excon::Errors::SocketError (getaddrinfo: Name or service not known (SocketError)):Churchlike
C
25

The region name is wrong. It should be 'us-east-1'

Chigetai answered 24/8, 2012 at 19:39 Comment(8)
Thanks. Hard to get the region name right. Here's a reference: docs.aws.amazon.com/general/latest/gr/rande.htmlHistone
@Chigetai why is this not working with other regions? doesnt make sense?Immersionism
@Immersionism it must be set to the region of your bucket. If your Amazon bucket is in 'us-east-1', then using 'eu-east-1' or any other won't work properly.Chigetai
Thought 'us-standard' would work, but only 'us-east-1' does. Thanks!Parted
Thanks for the link Arcoyle. Anybody using a server different from default one will get'ya gotcha'd because the S3 admin tools sometimes outright specify 'Ireland'.Septarium
This is only true if the bucket is in Us Standard. In Ireland it would be correct 'eu-west-1'Aster
yes @dioshari, it is explained in the comments above.Chigetai
I don't understand why Amazon lists us-standard as a region when it really isn't one.Consol

© 2022 - 2024 — McMap. All rights reserved.