Question

I don't know where else to turn with this: I have spent many hours on my project, a recruiting events website for college students, but have reached quite the impasse.

In short, I plodded along in localhost - adding components like Devise; Omniauth authentication via providers Facebook, LinkedIn, and Google - building a website I was proud of along the way. Everything appeared to be working just fine, but once I pushed to 'heroku master' things started breaking big time.

I think the issues are most likely in or around:I have an Authentication model to keep track of a single user's authentication providers, alongside the User model (where all the oauth code is kept).

Without further ado, here is my app's heroku domain and my code:

http://lit-everglades-7633.herokuapp.com/
https://gist.github.com/mecampbellsoup/6357855

The things breaking which I suspect are related:

  • 'heroku run rake db:seed' following 'pg:reset' & 'rake db:migrate'... instead of seeding with the contents of the seed file itself, a single blank Event and Company are created; more on this below
  • the routing and action relating to the omniauth request seems to be working just fine, according to the heroku logs (below) but no user nor authentication is actually created:

  • when, after resetting postgres db, I try to run 'heroku run rake db:create' or 'db:setup' I am whined at as follows:

☁ duke_recruits [master] heroku run rake db:setup
Running rake db:setup attached to terminal... up, run.5886
FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.

  • also, 'heroku run rake db:seed' appears to be doing its thing, but then my db only has 1 empty Event and 1 empty Company:

☁ duke_recruits [master] heroku run rake db:seed
Running rake db:seed attached to terminal... up, run.1767

☁ duke_recruits [master] heroku run rails c
Running rails c attached to terminal... up, run.6135
Event.allLoading production environment (Rails 4.0.0)
irb(main):001:0> Event.all
=> #ActiveRecord::Relation [#Event id: 1, title: nil, location: nil, description: nil, date: nil, end_date: nil, company_id: nil, created_at: "2013-08-27 19:30:06", updated_at: "2013-08-27 19:30:06"]
irb(main):002:0> Company.all
=> #ActiveRecord::Relation [#Company id: 1, name: nil, description: nil, website: nil, logo: nil, created_at: "2013-08-27 19:30:06", updated_at: "2013-08-27 19:30:06"]

Logs (upon opening the app on heroku and trying google authentication):

2013-08-27T19:49:18.701285+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:18 +0000
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Rails 4.0.0 application starting in production on http://0.0.0.0:49710
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Booting WEBrick
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Run `rails server -h` for more startup options
2013-08-27T19:49:18.701019+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:18 +0000
2013-08-27T19:49:19.131115+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=2ms service=442ms status=304 bytes=0
2013-08-27T19:49:19.221284+00:00 heroku[router]: at=info method=GET path=/assets/application-b44a43097f814ac98347f6802323e25f.js host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=12ms status=304 bytes=0
2013-08-27T19:49:49.440894+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:49 +0000
2013-08-27T19:49:49.440894+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:49 +0000
2013-08-27T19:49:49.515520+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=2ms service=80ms status=304 bytes=0
2013-08-27T19:50:48.534099+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:50:48 +0000
2013-08-27T19:50:48.534099+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:50:48 +0000
2013-08-27T19:50:48.575279+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=51ms status=304 bytes=0
2013-08-27T19:50:52.293922+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:50:52 +0000
2013-08-27T19:50:52.293922+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:50:52 +0000
2013-08-27T19:50:52.591752+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=307ms status=304 bytes=0
2013-08-27T19:51:00.368352+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.368352+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.368926+00:00 app[web.1]: I, [2013-08-27T19:51:00.368823 #2] INFO -- omniauth: (google_oauth2) Request phase initiated.
2013-08-27T19:51:00.392262+00:00 heroku[router]: at=info method=GET path=/users/auth/google_oauth2 host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=3ms service=33ms status=302 bytes=469
2013-08-27T19:51:00.715597+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.715597+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.716822+00:00 app[web.1]: I, [2013-08-27T19:51:00.716706 #2] INFO -- omniauth: (google_oauth2) Request phase initiated.
2013-08-27T19:51:00.997866+00:00 app[web.1]: Started GET "/users/auth/google_oauth2/callback?state=40ecfd10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code=4/D_(omitted_for_security)_GBlmiYhY(partially_omitted)E9yth.QpxI3jdcGpYYshQV0ieZDAoQOqyCgQI" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.997866+00:00 app[web.1]: Started GET "/users/auth/google_oauth2/callback?state=10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code=4/D_GBlmiYhY1rCvgdgE9yth.QpxI3jdcGpYYshQV0ieZDAoQOqyCgQI" for 68.175.76.48 at 2013-08-27 19:51:00 +0000
2013-08-27T19:51:00.998508+00:00 app[web.1]: I, [2013-08-27T19:51:00.998379 #2] INFO -- omniauth: (google_oauth2) Callback phase initiated.
2013-08-27T19:51:02.188467+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:51:02 +0000
2013-08-27T19:51:02.188467+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:51:02 +0000
2013-08-27T19:51:02.234644+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=9ms service=52ms status=304 bytes=0

Please let me know what questions you have for me and if I can clarify anything at all. I really appreciate your time & help SO!

Était-ce utile?

La solution

After a pg:reset, you can run the create command, but it usually gives you output like:

slkdjfs0dslkd already exists

So then you'll know that your database is created and ready to be used. Before you can seed though make sure you migrate. Just the standard heroku way

heroku run rake db:migrate

Then seed as normal

heroku run rake db:seed
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top