1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Excon::Error::Socket: getaddrinfo: Name or service not known (SocketError)というエラー文の対応

Posted at

環境

$ ruby -v
ruby 2.6.5
$ rails -v
Rails 5.2.4

Amazon Linux 2

状況

本番環境としてデプロイした後に、画像をCarriorwave,fogを通じてS3にアップロードしようとすると、エラーが発生。
エラー文は以下の2種類。

Excon::Error::Socket: getaddrinfo: Name or service not known (SocketError)
SocketError: getaddrinfo: Name or service not known

本件の原因

config/initializer/carrior_wave.rb
if Rails.env.production?
  CarrierWave.configure do |config|
    config.fog_provider = 'fog/aws'
    config.fog_credentials = {
      provider: 'AWS',
      region: 'ap-northeast-1a', # 問題箇所
      aws_access_key_id: 'アクセスキー',
      aws_secret_access_key: 'シークレットキー'
    }
    config.fog_directory = 'バケット名'
    config.cache_storage = :fog
  end
end

'ap-northeast-1a'なんてリージョンはなく、ap-northeast-1の間違いであった。

解決した対応

問題箇所のap-northeast-1aap-northeast-1にしてpumaを再起動した。

こんなしょうもないミスで2時間潰しました笑

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?