Question

My app runs properly locally and has a crash when it runs on Heroku. The app does fine until I run a new_post_path call. I tried git push to see if a change to the new.html.erb file or the _form.html.erb file was the issue - but I think during the last push to heroku - my database may have taken a hit. At the time I was adding a t.text field (longtext) and it seems to be the issue.

So I wanted to roll back or totally re-start at heroku. But I have not found anyway to do it. Since this is not near production yet. Is there anyway to just create a new instance at heroku and push up to it?

Again, local version runs perfect. Thanks in advance for any ideas.

No correct solution

OTHER TIPS

I would say there are several ways to handle this problem

restarting heroku

Run $ heroku restart in the rails dir. Sometimes I believe in magic.

debugging

Use $ heroku log to debug what is causing the error.

migrate database

Perhaps you made a database change in local rails, while heroku rails didn't.

Run heroku run rake db:migrate

drop database and remigrate database

See this thread. Sometimes old migration might be in conflict with current migration. Do a clean migration, if the data in your database isn't important.

recreate heroku instance

run $ heroku apps:destroy –app appname and replace appname with your appname. Then delete the current heroku remote repository location from git. git remote rm heroku. Then recreate heroku. run $ heroku create. go through pushing your code and migrating database like usual.

Relaunching might be the least of your problems, so I suggest a few things:

  1. Review this Heroku article on releases, including the Heroku rollback feature.

  2. Add the PG Backups add-on to your app.

  3. I also recommend using something like the exception_notification gem in combination with the SendGrid add-on, so that you can get an email with details on the error as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top