New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excon::Errors::SocketError Broken pipe (Errno::EPIPE) #1659

Closed
shosanna opened this Issue Mar 12, 2013 · 7 comments

Comments

Projects
None yet
5 participants
@shosanna

shosanna commented Mar 12, 2013

When I try to upload an image with carrierwave/fog, I'm getting

Excon::Errors::SocketError in PhotosController#create
Broken pipe (Errno::EPIPE)

uploading just to the filesystem works, the problem is just when using S3. Here's my config

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => "AWS",
    :aws_access_key_id      => ENV["AWS_KEY"],
    :aws_secret_access_key  => ENV["AWS_SECRET"],
    :host                   => "s3.amazonaws.com",
    :endpoint               => "https://s3.amazonaws.com",
    :region                 => 'eu-west-1'
  }
  config.fog_directory  = 'foo'
  config.fog_public     = true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
end

There's nothing special going on in the controller

class PhotosController < ApplicationController

  def create
    photo = Photo.create!(params[:photo])
    redirect_to photo.activity
  end

end

Here's a full stacktrace

@geemus

This comment has been minimized.

Show comment
Hide comment
@geemus

geemus Mar 12, 2013

Member

@shosanna - It looks like you are specifying an endpoint https://s3.amazonaws.com which I would expect to match up with the us-east-1 region, but then specifying that it use the eu-west-1 region. Seems like one of those two values is likely not correct. Is the data in question in us or eu? Hopefully making those match with the right value (and each other) should help out, but let me know what you find. Thanks!

Member

geemus commented Mar 12, 2013

@shosanna - It looks like you are specifying an endpoint https://s3.amazonaws.com which I would expect to match up with the us-east-1 region, but then specifying that it use the eu-west-1 region. Seems like one of those two values is likely not correct. Is the data in question in us or eu? Hopefully making those match with the right value (and each other) should help out, but let me know what you find. Thanks!

@shosanna

This comment has been minimized.

Show comment
Hide comment
@shosanna

shosanna Mar 12, 2013

Thanks, the endpoint doesn't seem to be required after all, but you were right about the host mismatch. This works:

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => "AWS",
    :aws_access_key_id      => ENV["AWS_KEY"],
    :aws_secret_access_key  => ENV["AWS_SECRET"],
    :host                   => "s3-eu-west-1.amazonaws.com",
    :region                 => "eu-west-1"
  }
  config.fog_directory  = "ijacek"
  config.fog_public     = true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
end

shosanna commented Mar 12, 2013

Thanks, the endpoint doesn't seem to be required after all, but you were right about the host mismatch. This works:

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => "AWS",
    :aws_access_key_id      => ENV["AWS_KEY"],
    :aws_secret_access_key  => ENV["AWS_SECRET"],
    :host                   => "s3-eu-west-1.amazonaws.com",
    :region                 => "eu-west-1"
  }
  config.fog_directory  = "ijacek"
  config.fog_public     = true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
end

@shosanna shosanna closed this Mar 12, 2013

@geemus

This comment has been minimized.

Show comment
Hide comment
@geemus

geemus Mar 12, 2013

Member

@shosanna - great, yeah I knew endpoint shouldn't be needed for fog, but I wasn't sure about carrierwave. I think you can leave out the host value also (it should get set automatically based on the passed in region). That reduces the chances of getting back into the mismatch again. Anyway, glad to hear it is working for you.

Member

geemus commented Mar 12, 2013

@shosanna - great, yeah I knew endpoint shouldn't be needed for fog, but I wasn't sure about carrierwave. I think you can leave out the host value also (it should get set automatically based on the passed in region). That reduces the chances of getting back into the mismatch again. Anyway, glad to hear it is working for you.

@marcamillion

This comment has been minimized.

Show comment
Hide comment
@marcamillion

marcamillion Aug 28, 2014

I was having this same issue and it turns out to be an AWS access issue. I created a new user, via IAM, and didn't give them the right access credentials. In fact, they had access to nothing. So everything kept getting shut down. Once I assigned them to an existing group, everything worked!

marcamillion commented Aug 28, 2014

I was having this same issue and it turns out to be an AWS access issue. I created a new user, via IAM, and didn't give them the right access credentials. In fact, they had access to nothing. So everything kept getting shut down. Once I assigned them to an existing group, everything worked!

@geemus

This comment has been minimized.

Show comment
Hide comment
@geemus

geemus Aug 29, 2014

Member

@marcamillion Thanks again for sharing, definitely helpful to see what has fixed this for others.

Member

geemus commented Aug 29, 2014

@marcamillion Thanks again for sharing, definitely helpful to see what has fixed this for others.

@pwenig

This comment has been minimized.

Show comment
Hide comment
@pwenig

pwenig Apr 12, 2016

Just came across @marcamillion comment and that was exactly my problem! Thanks!

pwenig commented Apr 12, 2016

Just came across @marcamillion comment and that was exactly my problem! Thanks!

@codeodor

This comment has been minimized.

Show comment
Hide comment
@codeodor

codeodor Sep 16, 2017

Contributor

I ran into this after having openssl on the server updated. As soon as I restarted our app, the error went away.

Contributor

codeodor commented Sep 16, 2017

I ran into this after having openssl on the server updated. As soon as I restarted our app, the error went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment