Hey everyone,
I was having a bit of trouble with CarrierWave on Amazon S3 today. When attempting to upload files that were larger than ~150kb I received one of the following errors (depending on config):
getaddrinfo: Name or service not known carrierwave
Excon::Errors::SocketError in PhotosController#create
Broken pipe (Errno::EPIPE)
Despite the vague error, the solution was fairly simple. The region configured in my initialiser was different to the one my bucket was created in.
In order to find out which region you need, logon to your AWS console and browse to an uploaded image. Check the endpoint URL (properties > static website hosting) and simply copy the region. For examples:
Endpoint: testbucket123321.s3-website-us-west-2.amazonaws.com
Region: us-west-2
A couple of final tips if this doesn’t work for you:
You need the region codes, not the name. For instance, “Oregon” won’t work
Don’t forget to restart your app after making changes to the initialiser