1

So I've tested my application locally in both Development and Production environments and everything seems to be working fine until I push to Heroku. When I check the logs on Heroku, I get the following:

    2011-03-21T22:37:42-07:00 heroku[slugc]: Slug compilation started
    2011-03-21T22:38:43-07:00 heroku[api]: Deploy f9bb672 by some.email@gmail.com
    2011-03-21T22:38:43-07:00 heroku[web.1]: State changed from created to starting
    2011-03-21T22:38:43-07:00 heroku[slugc]: Slug compilation finished
    2011-03-21T22:38:46-07:00 app[web.1]: /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError)
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/config/environment.rb:5
    2011-03-21T22:38:46-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    2011-03-21T22:38:46-07:00 app[web.1]:   from config.ru:3
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:18
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1:in `new'
    2011-03-21T22:38:46-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from starting to crashed
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from crashed to created
    2011-03-21T22:38:47-07:00 heroku[web.1]: State changed from created to starting
    2011-03-21T22:38:49-07:00 app[web.1]: /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError)
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/config/environment.rb:5
    2011-03-21T22:38:49-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    2011-03-21T22:38:49-07:00 app[web.1]:   from config.ru:3
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:18
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:11
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1:in `new'
    2011-03-21T22:38:49-07:00 app[web.1]:   from /home/heroku_rack/heroku.ru:1
    2011-03-21T22:38:50-07:00 heroku[web.1]: State changed from starting to crashed
    2011-03-21T22:39:00-07:00 heroku[rake.1]: State changed from created to starting
    2011-03-21T22:39:06-07:00 heroku[rake.1]: State changed from starting to complete
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/ dyno=none queue=0 wait=0ms service=0ms bytes=0
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET / HTTP/1.1 | 173.51.104.168 | 796 | http | 503
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/favicon.ico dyno=none queue=0 wait=0ms service=0ms bytes=0
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET /favicon.ico HTTP/1.1 | 173.51.104.168 | 795 | http | 503

I'm assuming that it is because I'm trying to include a module that I created in my /lib directory called Utils.

In my controller I do the following:

   include Utils

The filename is Utils.rb and the structure of the module is:

    module Utils
        def some_function
        end
    end

Not sure what the issue may be, but I've taken the following steps:

  • Adding config.autoload_paths += %W(#{config.root}/lib) to my application.rb file
  • Setting config.serve_static_assets = true in my production.rb file since some of my css and javascript wasn't being sent correctly
  • Making sure of running heroku rake db:migrate
  • Making sure I pushed the latest version from git to heroku

Basically I'm running out of ideas and I really would love to solve this issue, any help would be greatly appreciated. Thank You!

alvincrespo
  • 9,224
  • 13
  • 46
  • 60
  • I've found that the following question has helped me: http://stackoverflow.com/questions/4074830/adding-lib-to-config-autoload-paths-in-rails-3-does-not-autoload-my-module but I will be trying @Rishav's suggestion below and getting back to this in the morning. – alvincrespo Mar 22 '11 at 06:34

1 Answers1

1

Please make sure that the filename is utils.rb instead of Utils.rb.

Rishav Rastogi
  • 15,484
  • 3
  • 42
  • 47