Search code examples
ruby-on-railsherokuruby-on-rails-3.1rails-3.1cedar

heroku run console returns 'Error connecting to process'


I have deployed a rails 3.1 app to Heroku Cedar stack, and am trying to perform a:

heroku run rake db:migrate

it returns:

Running console attached to terminal... 
Error connecting to process

I also try to simply launch the console:

heroku run console

Any run command returns the same error.

Running console attached to terminal... 
Error connecting to process

Looking at the logs I get the error code:

2011-09-25T16:04:52+00:00 app[run.2]: Error R13 (Attach error) -> Failed to attach to process

When I heroku ps to see the current processes, I can see my attempts are running:

Process       State               Command
------------  ------------------  ------------------------------
run.2         complete for 26m    bundle exec rails console
run.3         up for 27s          bundle exec rails console
run.4         up for 3s           bundle exec rake db:create
web.1         up for 46s          bundle exec thin start -p $PORT -e..

But again each of them are raising exceptions:

2011-09-25T16:31:47+00:00 app[run.3]: Error R13 (Attach error) -> Failed to attach to process
2011-09-25T16:31:47+00:00 heroku[run.3]: Process exited
2011-09-25T16:31:48+00:00 heroku[run.3]: State changed from up to complete
2011-09-25T16:32:11+00:00 app[run.4]: Error R13 (Attach error) -> Failed to attach to process
2011-09-25T16:32:11+00:00 heroku[run.4]: Process exited
2011-09-25T16:32:12+00:00 heroku[run.4]: State changed from up to complete

Server Admin isnt my cup of tea, hence the decision to use Heroku.

Both Heroku docs and Googling have not led me down a path that give me much to go on.

Any ideas? This has not been my experience on the Bamboo stack.

My other errors are obviously related to DB migrations not being performed. Until I can run the rake tasks, I'm stuck moving forward.


Solution

  • I had the same problem, and although I did not solve the problem, I found a workaround.

    Instead of using:

    heroku run rake db:migrate

    You can use:

    heroku run:detached rake db:migrate

    This runs the command in the background, writing the output to the log. When it is finished you can view the log for the result.

    Not ideal, but when you are on an inadequate network, it will get you out of a hole :)