Search code examples
ruby-on-railsherokuthin

missing config directory on Heroku - LoadError in config.ru


UPDATE
I know now (from running heroku run bash and ls -la) that indeed the config directory is missing after deployment to heroku. It is however present in local repository.


.gitignore

/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3

# Ignore all logfiles and tempfiles.
/log/*.log
*.log
/tmp

After I push my application to heroku I get a LoadError for /app/config/environment, which has not happened in previous releases. No changes to config.ru were made. The file config/environment.rb is present.

I tried a rollback, but couldn't because the previous release has a different add-on set.

How can I solve this error?

Heroku logs:


2012-05-09T03:59:15+00:00 heroku[slugc]: Slug compilation started
2012-05-09T04:00:36+00:00 heroku[api]: Release v48 created by xxx
2012-05-09T04:00:36+00:00 heroku[api]: Deploy ac5eee6 by xxx
2012-05-09T04:00:36+00:00 heroku[web.1]: State changed from crashed to created
2012-05-09T04:00:36+00:00 heroku[web.1]: State changed from created to starting
2012-05-09T04:00:36+00:00 heroku[slugc]: Slug compilation finished
2012-05-09T04:00:44+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 6745`
2012-05-09T04:00:47+00:00 app[web.1]: /app/config.ru:3:in `require': no such file to load -- /app/config/environment (LoadError)
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:3:in `block in <main>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:36:in `eval'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:36:in `load'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/rack/adapter/loader.rb:45:in `for'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:169:in `load_adapter'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/controllers/controller.rb:73:in `start'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:185:in `run_command'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/runner.rb:151:in `run!'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/bin/thin:6:in `<top (required)>'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-05-09T04:00:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
2012-05-09T04:00:47+00:00 app[web.1]: >> Using rack adapter
2012-05-09T04:00:48+00:00 heroku[web.1]: Process exited with status 1
2012-05-09T04:00:48+00:00 heroku[web.1]: State changed from starting to crashed

config.ru


# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
run ItAngel::Application

Solution

  • I have contacted heroku on a similar issue for my app, we discovered that removing the file .slugignore which is beside file .gitignore fixed the problem.

    May be its the same case at your side, you can see my question here: why config folder is not pushed?

    and see my answer to my question.

    I hope this will help