6

I am a little lost with Heroku and Carrierwave Gem. I have read the WIKI, Read me and searched the net and i admit, i need help. Everything well on local but Heroku crushes the application.

///ERROR MESSAGE FROM HEROKU LOGS

2012-01-03T17:33:26+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/carrierwave-0.5.8/lib/carrierwave/uploader/configuration.rb:91:in `eval': uninitialized constant CarrierWave::Storage::Fog (NameError

///GEM FILE

gem "fog"
gem 'carrierwave'

/app/uploaders/avatar_uploader.rb

storage :fog

/config/initializers/carrierwave.rb

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',    
    :aws_access_key_id      => 'XXXX',    
    :aws_secret_access_key  => 'XXXX',   
    :region                 => 'eu-west-1'  # optional, defaults to 'us-east-1'
  }
  config.fog_directory  = 'site_images'  # required
  config.fog_public     = true     # optional, defaults to true
  config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}  # optional, defaults to {}
end

When i change the storage to file not fog, then i do not get errors. Are there any other fog settings i am skipping or missing. Any help greatly appreciated. Do i need to create a separate document with fog settings?

3
  • You haven't missed anything - but just to check the obvious, you have bundled and committed the lock file and pushed that to heroku? I'm running the same version of Carrierwave as you on Heroku with Fog and it's fine so it's something specific for your case I'm afraid. You don't happen to have any fog credentials in lib/carrierwave do you? Jan 3, 2012 at 20:09
  • Thanks John, Habe bundled and committed. Carrierwave talk of adding the file in the lib directory. I only have /config/initializers/carrierwave.rb should i have the file under the lib directory?
    – Benjamin
    Jan 3, 2012 at 20:42
  • no, you're exactly right in config/initializers - lib/carrierwave is known to cause the error you're getting. Jan 3, 2012 at 20:49

1 Answer 1

0

It might not be the solution to your problem but it is worth a try adding

config.cache_dir = "#{Rails.root}/tmp/uploads". That will help keep the files around until they are uploaded to you S3 bucket.

If that does not help can you also post your uploader file?

1
  • Thanks Yuri i will add that line. Much appreciated.
    – Benjamin
    Jan 4, 2012 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.