Why is "rake assets: precompile` throwing" getaddrinfo: name or service unknown? "(re: asset_sync)

I am trying to configure a rails application to upload my assets to Amazon AWS S3 using asset_sync gem after these instructions . I know that I have S3 settings correctly, because in other cases my application can upload images to S3. I am sure that I have all the settings correct:

FOG_DIRECTORY => mybucketname FOG_PROVIDER => AWS FOG_REGION => s3-us-west-2 

But I still get the error message:

 -bash> heroku run rake assets:precompile --remote staging Running rake assets:precompile attached to terminal... up, run.1 AssetSync: using default configuration from built-in initializer mkdir -p /app/public/assets ... mkdir -p /app/public/assets AssetSync: Syncing. rake aborted! getaddrinfo: Name or service not known # <-- error 

Compiling locally causes a slightly different error:

 -bash> bundle exec rake assets:precompile AssetSync: using default configuration from built-in initializer mkdir -p /Users/bart/Dev/MyApp/myapp/public/assets ... mkdir -p /Users/bart/Dev/MyApp/myapp/public/assets AssetSync: Syncing. rake aborted! getaddrinfo: nodename nor servname provided, or not known # <-- error 
+7
source share
1 answer

I traced the error to the 'connection' line in Fog , one of the asset_sync dependencies, and it turns out that my FOG_REGION set incorrectly . In my case, the area should be us-west-2 , not s3-us-west-2 .

It has been a while since I set up my S3 account, so I first tried to determine which region I was using by logging into the AWS S3 console by clicking on the bucket name and clicking Properties. There, the region is listed as Oregon. Well, that didn't work. So, I clicked through the browser the objects and folders of one of my existing buckets until I got to the asset, looked at its “Properties” and saw “Link”:

https://s3-us-west-2.amazonaws.com/mybucketname/uploads/mymodel/image/1135/myimage.jpg

I was convinced that s3-us-west-2 was right until I noticed that Fog adds the s3 prefix .

In any case, now I know that as soon as you recognize your region by name (for example, Oregon), you can find it in this list of S3 regions (this is the name under the Location Constraint column).

I hope this helps someone.

+10
source

All Articles