get broken pipe while uploading image to s3 amazon using paper clip
I get a broken pipe error while uploading image to s3 amazon using paper clip
My Model:
has_attached_file :avatar, :styles => { :small => "100x100#", :large => "500x500>" },
:processors => [:cropper],
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "/:style/:id/:filename",
:bucket => "shahbunder"
My s3.yml:
development:
bucket: xxx
access_key_id: 开发者_如何学运维xxx
secret_access_key: xxx
test:
bucket: xxx
access_key_id: xxx
secret_access_key: xxx
production:
bucket: xxx
access_key_id: xxx
secret_access_key: xxx
Note for people searching for a solution to an error that crosses between this and ERRCONNRESET - Response time skewed - your server clock is not synchronized with Amazon correctly.
This error occurs if you type your bucket name using "/" (ex: "bucket_name/"), use only the name (ex: "bucket_name").
I believe this is usually because your s3 credentials are wrong. But here are 2 different things you can try:
script/plugin install git://github.com/thoughtbot/paperclip.git (installing paperclip as a plugin instead of a gem has helped some)
gem install right_aws right_http_connection (make sure you are firing off your request correctly)
Try using Fog instead, I don't know if it's still undocumented or what:
Example (fit to your needs):
has_attached_file :media,
storage: :fog,
hash_secret: Settings.aws.uploader.hash_secret,
use_timestamp: Settings.aws.uploader.use_timestamps_in_url,
fog_credentials: Settings.aws.uploader.fog.to_hash,
fog_public: Settings.aws.uploader.public_files,
fog_directory: Settings.aws.s3.bucket_cname,
fog_host: "http://s.my.com",
default_url: "media/system/not_available.mp3",
hash_data: ":class/:attachment/:id/:style/:updated_at",
path: ":root_path/:id_partition",
#only_process:
processors: [:audio_thumbnail],
styles: { small: ['36x36#', :jpg], medium: ['72x72#', :jpg], large: ['115x115#', :jpg] },
skip_updated_at: true
精彩评论