getaddrinfo Name or service not known Socket Error s3 fog carrierwave Figaro

13,548

That's because there is no such host: s3.example.com.

Remove host and endpoint keys from config.fog_credentials hash.

Share:
13,548
thilakg
Author by

thilakg

Updated on June 28, 2022

Comments

  • thilakg
    thilakg almost 2 years

    I'm having the problem when i am using amazon s3 services

    the error is

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

    This error occur when i try to save the image.

    config/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"
    

    app/uploaders/picture_uploader.rb

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

    i followed this site enter link description here and didn't made any changes other configurations.

    i have deployed my application to heroku. i want to upload images/videos to that application. can anyone help or suggest me to how to upload images/videos to heroku with using carrierwave.

    Thanks advance