jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

Gem doesn't work with S3 #202

Open eugen0329 opened 7 years ago

eugen0329 commented 7 years ago

Using the following configs I get uploaded file with 0 byte file uploaded to s3 bucket.

#db/migrate/20170216113435_add_p_to_user.rb
class AddPToUser < ActiveRecord::Migration[5.0]
  def change
    add_column :users, :avatar_processing, :boolean
  end
end
# app/models/user.rb
class User < ApplicationRecord
  has_attached_file :avatar, styles: {thumb: "100x100#"}
  validates_attachment_content_type :avatar, content_type:["image/jpg", "image/jpeg", "image/png", "image/gif"]

  process_in_background :avatar
end
# config/application.rb
#....

  class Application < Rails::Application
    config.active_job.queue_adapter = :sidekiq

    config.paperclip_defaults = {
      storage: :s3,
      s3_region: 'us-west-2',
      s3_host_name: "s3-us-west-2.amazonaws.com",
      s3_credentials: {
        bucket: 'bucket_name',
        access_key_id: 'xxx',
        secret_access_key: 'xxx',
        s3_region: 'us-west-2',
      }
    }
  end

Extra info

  rails (~> 5.0.1)
  delayed_paperclip (~> 3.0, >= 3.0.1)
  paperclip (5.1.0)
  delayed_paperclip (3.0.1)
  sidekiq (4.2.9)
  paperclip-av-transcoder (0.6.4)
#sidekiq log
2017-02-16T12:01:29.951Z 7471 TID-rm9ck DelayedPaperclip::ProcessJob JID-e16b95988df375eab98f7b99 INFO: start
2017-02-16T12:01:33.730Z 7471 TID-rm9ck DelayedPaperclip::ProcessJob JID-e16b95988df375eab98f7b99 INFO: done: 3.779 sec

The same problem occurs when I use the gem with rails (= 4.2.7.1) and paperclip-av-transcoder postprocessor.

8vius commented 7 years ago

I'm having this same issue, my uploads work fine without the gem enabled but as soon as I place the setting for processing in background nothing gets uploaded besides the original image.

Cameron2920 commented 7 years ago

I would suggest trying Paperclip v5.0.0. I was having problems with 5.1.0 and I'm using s3, but using v5.0.0 seems to fix most of my problems.

11factory commented 7 years ago

same issue and fixed by downgrading aws-sdk from 3.0.1 to 2.10.39

Xosmond commented 7 years ago

On my case the DelayedPaperclip worker doesn't even appear on sidekiq log. And It stills upload on normal way to S3.

I have downgraded aws-sdk from 3.0.1 to 2.10.39 Paperclip 5.1.0 to 5.0.0

And the same problem happens.