lardawge / carrierwave_backgrounder

Offload CarrierWave's image processing and storage to a background process using ActiveJob or Sidekiq..
736 stars 402 forks source link

CarrierWave::Workers::ProcessAsset failed with NameError #145

Closed ghost closed 11 years ago

ghost commented 11 years ago

Whenever I try to use the addon, I get: CarrierWave::Workers::ProcessAsset failed with NameError: uninitialized constant Painting - 3 failed attempts

Using rails 3.2.13, latest version of backgrounder.

How do I resolve this?

ghost commented 11 years ago

Here's a New Relic stack trace:

Error message
NameError: uninitialized constant Painting

Stack trace (show Rails)
…ounder-0.2.1/lib/backgrounder/workers/process_asset.rb:  29:in `constantized_resource'
…ounder-0.2.1/lib/backgrounder/workers/process_asset.rb:  12:in `perform'
…0.0/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:  95:in `block in invoke_job'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…0.0/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:  92:in `invoke_job'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 203:in `block (2 levels) in run'
       /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:  66:in `timeout'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 203:in `block in run'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 202:in `run'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 259:in `block in reserve_and_run_one_job'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 259:in `reserve_and_run_one_job'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 187:in `block in work_off'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 186:in `times'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 186:in `work_off'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 151:in `block (4 levels) in start'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 150:in `block (3 levels) in start'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 149:in `block (2 levels) in start'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 148:in `loop'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 148:in `block in start'
…s/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:   7:in `call'
…s/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:   7:in `block (2 levels) in <class:ClearLocks>'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  78:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  78:in `block (2 levels) in add'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  78:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  78:in `block in add'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 147:in `start'
…ruby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/tasks.rb:   9:in `block (2 levels) in <top (required)>'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 236:in `call'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 236:in `block in execute'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 231:in `each'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 231:in `execute'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 175:in `block in invoke_with_call_chain'
       /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb: 211:in `mon_synchronize'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 168:in `invoke_with_call_chain'
…or/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/task.rb: 161:in `invoke'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 149:in `invoke_task'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 106:in `block (2 levels) in top_level'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 106:in `each'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 106:in `block in top_level'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 115:in `run_with_threads'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 100:in `top_level'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:  78:in `block in run'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb: 165:in `standard_exception_handling'
…le/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:  75:in `run'

and a rails stack trace:

…support-3.2.13/lib/active_support/inflector/methods.rb: 230:in `block in constantize'
…support-3.2.13/lib/active_support/inflector/methods.rb: 229:in `each'
…support-3.2.13/lib/active_support/inflector/methods.rb: 229:in `constantize'
…2.13/lib/active_support/core_ext/string/inflections.rb:  54:in `constantize'
…ounder-0.2.1/lib/backgrounder/workers/process_asset.rb:  29:in `constantized_resource'
…ounder-0.2.1/lib/backgrounder/workers/process_asset.rb:  12:in `perform'
…0.0/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:  95:in `block in invoke_job'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  65:in `execute'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  38:in `run_callbacks'
…0.0/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:  92:in `invoke_job'
(eval):3:in `block in invoke_job_with_newrelic_transaction_trace'
(eval):2:in `invoke_job_with_newrelic_transaction_trace'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 203:in `block (2 levels) in run'
       /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:  66:in `timeout'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 203:in `block in run'
     /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/benchmark.rb: 296:in `realtime'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 202:in `run'
…uby/2.0.0/gems/delayed_job-3.0.5/lib/delayed/worker.rb: 259:in `block in reserve_and_run_one_job'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `call'
…/2.0.0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:  60:in `block in initialize'
lardawge commented 11 years ago

What's the name of the model your attachment is on? Can you post the code in the model?

ghost commented 11 years ago

Here's the relevant code in my Painting model that I am uploading the image to. It seems to work fine locally and with foreman, but on Heroku it throws the above errors:

class Painting < ActiveRecord::Base

  belongs_to :status

  has_many :detailed_images, as: :imageable, inverse_of: :imageable

  belongs_to :gallery, touch: true
  has_many :enquiries

  # - - - - - - - - - - - - - - - - 
  # Attributes
  # - - - - - - - - - - - - - - - - 
  attr_accessible :commentable, :content, :dimensions, :exhibition_link, :exhibition_title, :featured, :image, :image_cache, :remove_image, :meta_description, :meta_keywords, :meta_title, :slug, :title, :piggybak_sellable_attributes, :gallery_id, :tag_list, :crop_x, :crop_y, :crop_w, :crop_h, :created_at, :status_id, :detailed_images_attributes

  attr_accessor :crop_x, :crop_y, :crop_w, :crop_h

  accepts_nested_attributes_for :detailed_images, allow_destroy: true

  validates_presence_of :dimensions, :image, :slug, :title, :gallery_id, :meta_description, :meta_keywords, :meta_title

  def self.featured
    featured = Painting.where(featured: true).first
    if featured.nil?
      Painting.last
    else
      featured
    end
  end

  # - - - - - - - - - - - - - - - - 
  # Sellable
  # - - - - - - - - - - - - - - - - 
  acts_as_sellable_with_variants

  # - - - - - - - - - - - - - - - - 
  # Tags
  # - - - - - - - - - - - - - - - - 
  acts_as_taggable

  # - - - - - - - - - - - - - - - - 
  # Custom slugs/permalinks
  # - - - - - - - - - - - - - - - - 
  extend FriendlyId
  friendly_id :title, use: :slugged

  # - - - - - - - - - - - - - - - - 
  # Carrierwave uploader
  # - - - - - - - - - - - - - - - - 
  mount_uploader :image, ImageUploader
  process_in_background :image

  # - - - - - - - - - - - - - - - - 
  # Elasticsearch
  # - - - - - - - - - - - - - - - - 
  include Tire::Model::Search
  include Tire::Model::Callbacks
  index_name INDEX_NAME

  mapping do
    indexes :id, index: :not_analyzed
    indexes :title, boost: 100
    indexes :slug, boost: 100, as: 'slug'
    indexes :content, boost: 100
    indexes :image, as: 'image.thumb.url'
    indexes :tags, as: 'tags'
    indexes :status_id
    indexes :gallery_name, as: 'gallery.name'
    indexes :created_at, :type => 'date'
  end
lardawge commented 11 years ago

Are you using delayed_job_active_record? It seems like the rails environment isn't loaded when you are running workers.

ghost commented 11 years ago

Yes, here is my gemfile:

source 'https://rubygems.org'

ruby "2.0.0"
gem 'rails', '3.2.13'

gem 'pg'

gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'

gem 'piggybak', '0.6.28'
gem "piggybak_variants", '0.0.15'
gem 'piggybak_paypal', :git => 'git://github.com/timmyc/piggybak_paypal.git'

gem 'devise'
gem "cancan"

gem 'haml'
gem 'haml-rails'

gem 'countries', :require => 'iso3166'

gem "figaro"

gem 'redactor-rails'
gem "carrierwave"
gem 'rmagick', '2.13.2'
gem "mini_magick"
gem "fog"

gem 'turbolinks'

gem 'tire', '0.5.7' # elastic search

gem 'kaminari'

gem "friendly_id", "~> 4.0.9"
gem 'acts-as-taggable-on', '>= 2.3.1'
gem 'acts_as_list'
gem 'meta-tags', :require => 'meta_tags'

# Caching
gem 'cache_digests'
gem 'dalli'

# Background processes
gem 'daemons'
# gem 'carrierwave_direct'
gem 'carrierwave_backgrounder'
gem "delayed_job_active_record"
gem "workless", "~> 1.1.1"

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
  gem 'asset_sync'
end

group :development do
  gem 'bullet'
  gem 'meta_request'
end

gem 'jquery-rails'

gem "unicorn-rails"
gem 'newrelic_rpm'

and gemfile.lock:

GIT
  remote: git://github.com/sferik/rails_admin.git
  revision: b8465f738261594b8f8864a4bed810ba5c34953f
  specs:
    rails_admin (0.4.7)
      bootstrap-sass (~> 2.2)
      builder (~> 3.0)
      coffee-rails (~> 3.1)
      font-awesome-sass-rails (~> 3.0, >= 3.0.0.1)
      haml (~> 4.0)
      jquery-rails (~> 2.1)
      jquery-ui-rails (~> 3.0)
      kaminari (~> 0.14)
      nested_form (~> 0.3)
      rack-pjax (~> 0.6)
      rails (~> 3.1)
      remotipart (~> 1.0)
      safe_yaml (~> 0.6)
      sass-rails (~> 3.1)

GIT
  remote: git://github.com/timmyc/piggybak_paypal.git
  revision: 02cc620fc819f3da33f9f3216ab8682c32dcbd58
  specs:
    piggybak_paypal (0.0.2)
      rails (~> 3.2.13)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_utils (1.0.5)
      activesupport (>= 2.3.11)
      i18n
    activemerchant (1.32.1)
      active_utils (>= 1.0.2)
      activesupport (>= 2.3.14)
      builder (>= 2.0.0)
      i18n
      json (>= 1.5.1)
      money
      nokogiri
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    acts-as-taggable-on (2.3.3)
      rails (~> 3.0)
    acts_as_list (0.2.0)
      activerecord (>= 3.0)
    ansi (1.4.3)
    arel (3.0.2)
    asset_sync (0.5.4)
      activemodel
      fog
    atomic (1.1.8)
    bcrypt-ruby (3.0.1)
    bootstrap-sass (2.3.1.0)
      sass (~> 3.2)
    builder (3.0.4)
    bullet (4.5.0)
      uniform_notifier
    cache_digests (0.3.0)
      actionpack (>= 3.2)
      thread_safe
    cancan (1.6.9)
    carrierwave (0.8.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
    carrierwave_backgrounder (0.2.1)
      carrierwave (~> 0.5)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.2)
    countries (0.9.2)
      currencies (>= 0.4.0)
    currencies (0.4.0)
    daemons (1.1.9)
    dalli (2.6.2)
    delayed_job (3.0.5)
      activesupport (~> 3.0)
    delayed_job_active_record (0.4.4)
      activerecord (>= 2.1.0, < 4)
      delayed_job (~> 3.0)
    devise (2.2.3)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (~> 3.1)
      warden (~> 1.2.1)
    erubis (2.7.0)
    excon (0.13.4)
    execjs (1.4.0)
      multi_json (~> 1.0)
    fattr (2.2.1)
    figaro (0.6.3)
      bundler (~> 1.0)
      rails (>= 3, < 5)
    fog (1.3.1)
      builder
      excon (~> 0.13.0)
      formatador (~> 0.2.0)
      mime-types
      multi_json (~> 1.0)
      net-scp (~> 1.0.4)
      net-ssh (>= 2.1.3)
      nokogiri (~> 1.5.0)
      ruby-hmac
    font-awesome-sass-rails (3.0.2.2)
      railties (>= 3.1.1)
      sass-rails (>= 3.1.1)
    formatador (0.2.4)
    friendly_id (4.0.9)
    haml (4.0.2)
      tilt
    haml-rails (0.4)
      actionpack (>= 3.1, < 4.1)
      activesupport (>= 3.1, < 4.1)
      haml (>= 3.1, < 4.1)
      railties (>= 3.1, < 4.1)
    hashr (0.0.22)
    heroku-api (0.2.1)
      excon (~> 0.13.3)
    hike (1.2.2)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.2.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (3.0.1)
      jquery-rails
      railties (>= 3.1.0)
    json (1.8.0)
    kaminari (0.14.1)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    kgio (2.8.0)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    meta-tags (1.4.1)
      actionpack
    meta_request (0.2.3)
      rack-contrib
      railties
    mime-types (1.23)
    mini_magick (3.5.0)
      subexec (~> 0.2.1)
    money (5.1.1)
      i18n (~> 0.6.0)
    multi_json (1.7.3)
    nested_form (0.3.2)
    net-scp (1.0.4)
      net-ssh (>= 1.99.1)
    net-ssh (2.6.7)
    newrelic_rpm (3.6.0.83)
    nokogiri (1.5.9)
    orm_adapter (0.4.0)
    pg (0.15.1)
    piggybak (0.6.28)
      activemerchant
      countries
      devise
      rack-ssl-enforcer
      rails (~> 3.2.8)
      rails_admin (~> 0.4.5)
    piggybak_variants (0.0.15)
      rails (~> 3.2.3)
    polyglot (0.3.3)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-pjax (0.7.0)
      nokogiri (~> 1.5)
      rack (~> 1.3)
    rack-ssl (1.3.3)
      rack
    rack-ssl-enforcer (0.2.5)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    raindrops (0.10.0)
    rake (10.1.0)
    rdoc (3.12.2)
      json (~> 1.4)
    redactor-rails (0.3.3)
      devise
      mime-types
      orm_adapter
    remotipart (1.0.5)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rmagick (2.13.2)
    ruby-hmac (0.4.0)
    rush (0.6.8)
      session
    safe_yaml (0.9.0)
    sass (3.2.7)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    session (3.1.0)
      fattr
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    subexec (0.2.3)
    thor (0.18.1)
    thread_safe (0.1.0)
      atomic
    tilt (1.4.1)
    tire (0.5.7)
      activemodel (>= 3.0)
      activesupport
      ansi
      hashr (~> 0.0.19)
      multi_json (~> 1.3)
      rake
      rest-client (~> 1.6)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (1.1.1)
      coffee-rails
    tzinfo (0.3.37)
    uglifier (2.0.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    unicorn (4.6.2)
      kgio (~> 2.6)
      rack
      raindrops (~> 0.7)
    unicorn-rails (1.0.1)
      rack
      unicorn
    uniform_notifier (1.2.0)
    warden (1.2.1)
      rack (>= 1.0)
    workless (1.1.2)
      delayed_job (>= 2.0.7)
      heroku-api
      rails
      rush

PLATFORMS
  ruby

DEPENDENCIES
  acts-as-taggable-on (>= 2.3.1)
  acts_as_list
  asset_sync
  bullet
  cache_digests
  cancan
  carrierwave
  carrierwave_backgrounder
  coffee-rails (~> 3.2.1)
  countries
  daemons
  dalli
  delayed_job_active_record
  devise
  figaro
  fog (~> 1.3.1)
  friendly_id (~> 4.0.9)
  haml
  haml-rails
  jquery-rails
  kaminari
  meta-tags
  meta_request
  mini_magick
  newrelic_rpm
  pg
  piggybak (= 0.6.28)
  piggybak_paypal!
  piggybak_variants (= 0.0.15)
  rails (= 3.2.13)
  rails_admin!
  redactor-rails
  rmagick (= 2.13.2)
  sass-rails (~> 3.2.3)
  tire (= 0.5.7)
  turbolinks
  uglifier (>= 1.0.3)
  unicorn-rails
  workless (~> 1.1.1)
lardawge commented 11 years ago

Try requiring delayed_job_active_record before carrierwave_backgrounder.

ghost commented 11 years ago

I had it that way before, I just changed it to this order as someone else needed to include the mongoose adapter before backgrounder so I thought I'd give it a shot.

Again it seems to work locally, just not when using a heroku worker.

Anthony

Sent from my iPhone

On Jul 4, 2013, at 9:41 PM, Larry Sprock notifications@github.com wrote:

Try requiring delayed_job_active_record before carrierwave_backgrounder.

— Reply to this email directly or view it on GitHub.

lardawge commented 11 years ago

Have you tried it without workless? This seems like it would be a problem with heroku and any worker that is referring to a active_record class. We really aren't doing anything special in the worker.

ghost commented 11 years ago

I played around with it more and came to a different error. I did rearrange the order of the gems, and am running foreman locally with the staging environment set. I run into the same problem without 'workless', but I removed it for now anyway.

The new error is:

undefined method `body' for nil:NilClass
/Users/ac/.rvm/gems/ruby-2.0.0-p0/bundler/gems/carrierwave-14306f9aa0e7/lib/carrierwave/storage/fog.rb:227:in `read'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/bundler/gems/carrierwave-14306f9aa0e7/lib/carrierwave/uploader/cache.rb:77:in `sanitized_file'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/bundler/gems/carrierwave-14306f9aa0e7/lib/carrierwave/uploader/cache.rb:116:in `cache!'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/bundler/gems/carrierwave-14306f9aa0e7/lib/carrierwave/uploader/versions.rb:225:in `recreate_versions!'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/gems/carrierwave_backgrounder-0.2.1/lib/backgrounder/workers/process_asset.rb:16:in `perform'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in `block in invoke_job'
/Users/ac/.rvm/gems/ruby-2.0.0-p0/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in `call'

which corresponds to this section of carrierwave: https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/storage/fog.rb#L227

I tried disabling fog and using the filesystem, but I still receive the same error.

Any thoughts on this new error? I'll post this over at carrierwave github as well.

lardawge commented 11 years ago

This seems to not be an issue with carrierwave_backgrounder. I will be happy to look at this again if evedence point to a problem in CB code.

ethnt commented 10 years ago

@anthonycollini Did you ever find a solution to this issue? I'm having the same problem, except with Mongoid and Sidekiq.

42ae commented 9 years ago

@anthonycollini It would be great to hear from you if you have found a solution by any chance. Thank you! I have the same problem on staging/production with Heroku / carrierwave / delayed_job / carrierwave_backgrounder and fog.

krnjn commented 9 years ago

+1

kntmrkm commented 9 years ago

I have same problem with sucker_punch and AWS.

nick123pig commented 9 years ago

Sanity check for everyone...make you're not using Time.now in your store_dir.