Getaddrinfo Name or service unknown Socket error s3 carrier wave fog Figaro

I have a problem when I use the services of amazon s3

error

Excon::Errors::SocketError in PhotosController#create getaddrinfo: Name or service not known (SocketError)} 

This error occurs when I try to save an image.

configurations / initializers / carrierwave.rb

 CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => 'XXXXX', :aws_secret_access_key => 'YYYYY', :region => 'us-east-1', :host => 's3.example.com', :endpoint => 'https://s3.example.com:8080' 

}

 config.fog_directory = 'My_bucket_name' config.fog_public = false config.fog_attributes = {'Cache-Control'=>"max-age=#{365.day.to_i}"} 

end

I am using figaro.gem

config /application.yml

 SECRET_KEY_BASE: aaaaaa AWS_ACCES_KEY_ID: XXXXXX AWS_SECRET_ACCESS_KEY: YYYYYY AWS_BUCKET: "My_bucket_name" 

Gemfile

 gem 'rails', '4.1.4' gem 'mysql2' gem 'carrierwave' gem 'fog' gem 'aws-sdk' gem "figaro" 

application / uploading / picture_uploader.rb

 class PictureUploader < CarrierWave::Uploader::Base storage :fog def store_dir 'uploads/data' end end 

i after this site, enter a description of the link here and made no changes to other configurations.

I deployed my application to the hero. I want to upload images / videos to this application. can someone help or suggest me how to upload images / videos to a hero using a carrier.

thanks in advance

+5
source share
1 answer

This is because there is no such host: s3.example.com .

Remove the host and endpoint keys from the config.fog_credentials hash.

+5
source

Source: https://habr.com/ru/post/1206479/


All Articles