Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Precompiled Assets Failed

I am having difficulties troubleshooting the following and figuring out why my assets are failing to precompile at slug compilation... the odd thing is, is that the assets compile fine at runtime when I check the live logs... any ideas? Is it trying to connect to the database?

Preparing app for Rails asset pipeline
   Running: rake assets:precompile
   rake aborted!
   undefined method `match' for nil:NilClass
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:104:in `new'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:104:in `parse'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:62:in `create_session'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:43:in `default'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions.rb:109:in `default'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid.rb:129:in `default_session'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/railtie.rb:131:in `block (2 levels) in <class:Railtie>'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `call'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/config/environment.rb:5:in `<top (required)>'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
   /tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
   Tasks: TOP => environment
   (See full trace by running task with --trace)
like image 973
Elliott de Launay Avatar asked Mar 23 '23 07:03

Elliott de Launay


1 Answers

Check whether your asset precompile requires access to ENV variables during when its run. Its hard to tell from your stack trace, but this might be a good resource to check out: https://devcenter.heroku.com/articles/rails-asset-pipeline

Essentially, you can enable the user-env-compile labs feature on heroku to give your app instance access to ENV vars during your precompile.

 heroku labs:enable user-env-compile -a myapp

more information about that here: https://devcenter.heroku.com/articles/labs-user-env-compile

like image 95
derekyau Avatar answered Mar 31 '23 13:03

derekyau