2

I'm publishing a Rails app on Heroku for the first time, and am running into an error. Everything works great, except only the landing page loads. From the landing page, there are sign-up and log-in buttons for Devise, but they just throw 500 error pages. I opened up the Heroku logs and see these:

2013-08-27T19:00:55.036186+00:00 app[web.1]: Processing by Devise::SessionsController#new as HTML
2013-08-27T19:00:55.035363+00:00 heroku[router]: at=info method=GET path=/users/sign_in host=infinite-escarpment-6269.herokuapp.com fwd="98.245.21.165" dyno=web.1 connect=3ms service=20ms status=500 bytes=643
2013-08-27T19:00:55.773025+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-escarpment-6269.herokuapp.com fwd="98.245.21.165" dyno=web.1 connect=2ms service=14ms status=304 bytes=0
2013-08-27T19:00:01.630144+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=infinite-escarpment-6269.herokuapp.com fwd="98.245.21.165" dyno=web.1 connect=5ms service=150ms status=500 bytes=643

I don't see any error codes in here. My app is using PostgreSQL and the only commands I ran on the database were heroku run rake db:create:all and heroku run rake db:migrate. Do I need to make any changes in my database.yml file to get the site working on Heroku? Do I need to write any migrations to get the site working on Heroku? I'm new to all of this, so I'm not sure. I've just been following the getting started instructions on Heroku.

UPDATE I tailed the logs and see this error message relating to PostgreSQL:

ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "users" does not exist

This error message is familar to me, but I can't remember what to do about it.

Tom Maxwell
  • 9,273
  • 17
  • 55
  • 68
  • Post more of the log, there should be a cause in there somewhere. – Nick Veys Aug 27 '13 at 19:11
  • heroku doesn't use your database.yml file, it creates its own. You shouldn't need any migrations to see pages load (as user is all devise needs and it writes its own). But try tailing the log and reloading the site and clicking on your devise links. Gives you more information to work with. `heroku logs --tail` – trh Aug 27 '13 at 19:38
  • I updated my question with an error I'm seeing. Doesn't this mean that there isn't a users table? – Tom Maxwell Aug 27 '13 at 19:56
  • Fixed it with the answers here: http://stackoverflow.com/questions/5450930/heroku-postgres-error-pgerror-error-relation-organizations-does-not-exist – Tom Maxwell Aug 27 '13 at 19:58
  • Note to Ruby Rails newbies: This error also occurs when only a test/dev app exists and there is no config for production. For example, a rails init will create such an app that will not be deployable to Heroku. – AnneTheAgile Oct 20 '14 at 02:00

2 Answers2

4

Error states that you don't have table users. Probably you didn't run migration.

Do it with:

heroku run rake db:migrate
Иван Бишевац
  • 13,811
  • 21
  • 66
  • 93
1

In my case devise was not loaded, so do you have require 'devise' at the top of /config/initializers/devise.rb ? if not add it locally then re-push to heroku and run heroku rake db:migrate , also if there any strange messages during pushing to heroku add it to your question.

Mostafa Hussein
  • 11,063
  • 3
  • 36
  • 61