Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails app crashes on Heroku but runs fine locally -> "State changed from starting to crashed"

repo at: [email protected]:assafshomer/sample_app.git

  1. This app is my learning app based on Michael Hartl's excellent railstutorial.
  2. App runs smoothly in development and test suite is all green
  3. When deploying to Heroku I get the following error immediatly: "Application Error. An error occurred in the application and your page could not be served"
  4. The problem started after upgrading to Rails4 (but I know the problem is not Rails4 itself because, e.g. git://github.com/railstutorial/sample_app_rails_4.git deploys fine to Heroku)
  5. I know you are going to ask "did you migrate the db on Heroku?". I did. I even ran pg:reset and then again rake db:migrate on Heroku just in case. They seemed to have run ok.

Heroku logs don't give any info either (at least, nothing I can see as useful)

2013-05-25T22:11:26.070468+00:00 heroku[web.1]: Process exited with
status 0
2013-05-25T22:11:26.083572+00:00 heroku[web.1]: State changed from
starting to crashed
2013-05-25T22:13:09.372294+00:00 heroku[run.4121]: State changed from up
to complete
2013-05-25T22:13:09.357146+00:00 heroku[run.4121]: Process exited with
status 1
2013-05-25T22:13:50.829887+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path=/ host=devsampleapp.herokuapp.com
fwd="93.172.16.63" dyno= connect= service= status=503 bytes=

also the rails console doesn't come up:

2013-05-26T06:41:34.942569+00:00 heroku[api]: Starting process with command `bin/rails console` by [email protected]
2013-05-26T06:41:38.312107+00:00 heroku[run.5325]: Awaiting client
2013-05-26T06:41:38.339816+00:00 heroku[run.5325]: Starting process with command `bin/rails console`
2013-05-26T06:41:39.112396+00:00 heroku[run.5325]: Client connection closed. Sending SIGHUP to all processes
2013-05-26T06:41:40.329832+00:00 heroku[run.5325]: Process exited with status 0
2013-05-26T06:41:40.357047+00:00 heroku[run.5325]: State changed from starting to complete

I submitted a support ticket with Heroku, but that will only be attended to earliest Tuesday, and I'm itching to get this "upgrade to rails4" working already, so, any help in resolving this mystery will be much appreciated.

obviously, the best way to reproduce is to clone the repo and deploy to heroku :)

Thanks!!

Assaf Shomer (assafshomer at gmail)

like image 964
Assaf Shomer Avatar asked May 26 '13 06:05

Assaf Shomer


1 Answers

In rails4 several files (bin/rails, bin/rake and bin/bundle) responsible for the startup phase have been newly added or moved from different locations (e.g. script/rails).

Seems that they are missing in your application. Strange thing indeed that it works on your local machine but not on heroku - but well I tried and added them. It seems to work.

You can create them by simply running rake rails:update:bin.

like image 116
ascyltos Avatar answered Oct 01 '22 14:10

ascyltos