Phoenix + Ueberauth + Google + Heroku : internal server error

368 Views Asked by At

I'm relatively new at Elixir and Phoenix (which is probably the reason I have no idea what's going on).

I'm trying to set up Ueberauth on a Phoenix app with Google authentication.

I followed the sample app https://github.com/ueberauth/ueberauth_example as faithfully as I could figure.

I prepared the app for Heroku like the Phoenix docs say. The home page shows up properly. When I click on my button to start the auth process, I get as far as Google and Google asks me if I do want to authenticate. When I click yes, I get an internal server error and I don't really know what's going on with it.

Here's what I have in the logs:

2016-03-24T04:02:14.429507+00:00 app[web.1]: 04:02:14.429 [error] #PID<0.364.0> running GreatStrides.Endpoint terminated

2016-03-24T04:02:14.429520+00:00 app[web.1]: Server: MYHEROKUAPP:80 (http)

2016-03-24T04:02:14.429521+00:00 app[web.1]: Request: GET /auth/google/callback?code=ACODEGOESHERE

2016-03-24T04:02:14.429522+00:00 app[web.1]: ** (exit) exited in: :gen_server.call(:hackney_manager, {:new_request, #PID<0.364.0>, #Reference<0.0.1.2373>, {:client, :undefined, {:metrics_ng, :metrics_dummy}, :hackney_ssl_transport, 'accounts.google.com', 443, "accounts.google.com", [], nil, nil, nil, true, :hackney_pool, 5000, false, 5, false, 5, nil, nil, nil, :undefined, :start, nil, :normal, false, false, false, :undefined, false, nil, :waiting, nil, 4096, "", [], :undefined, nil, nil, nil, nil, :undefined, nil}}, :infinity)

2016-03-24T11:54:59.195968+00:00 app[web.1]: ** (EXIT) no process

What's going on here?

1

There are 1 best solutions below

7
On BEST ANSWER

This should be a comment, but it was too long.

Do you have any other errors? Because this looks incomplete.

When something is wrong in Elixir application, supervision tree makes sure that all processes that encountered the error die. That is why you can see the first line GreatStrides.Endpoint terminated.

Second and third line is just a normal log.

Fourth line is an error calling gen_server. It prints the function call with all three arguments: server, request, timeout. You can inspect arguments if they are correct, but those are some internals of hackneys client record. GenServer client just waits for answer here for infinite amount of time - nothing should go wrong.

This means there should be another crash report from inside GenServer. It can be similar to previous one. There you should be able to find actual reason. If the GenServer crashes while doing its work, all clients waiting for answer are notified that it exited.

EDIT: After edits by @Trevoke

The problem was that the hackney gen_server was not running and this caused the error. Checking with Application.loaded_applications proved that hackney application is not running at all and it needs to be added to applications section in mix.exs.