peburrows / goth

Elixir package for Oauth authentication via Google Cloud APIs
http://hexdocs.pm/goth
MIT License
285 stars 108 forks source link

Could not start application goth #10

Closed ponty96 closed 7 years ago

ponty96 commented 7 years ago
screen shot 2016-11-29 at 12 10 00 am
peburrows commented 7 years ago

@ponty96 have you configured goth in your mix file with your json credentials, or are you running in GCE?

ponty96 commented 7 years ago

so I just did that and i'm getting this:

screen shot 2016-11-29 at 12 38 41 am
ponty96 commented 7 years ago

in my devs.exs

config :goth,
  json: "config/gce_credentials/client_secret.json" |> File.read!
peburrows commented 7 years ago

The error you're seeing now appears to be specific to your app and looks like it's because something is already listening on the port you're attempting to use. That's what the {:listen_error, Distru.Endpoint.HTTP, :eaddrinuse} is indicating.

ponty96 commented 7 years ago

yep. thanks

ponty96 commented 7 years ago

so i'm getting this error:

00:55:52.561 [info] Application goth exited: Goth.start(:normal, []) returned an error: shutdown: fai
led to start child: Goth.Config
    ** (EXIT) an exception was raised:
        ** (HTTPoison.Error) :nxdomain
            (httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
            (goth) lib/goth/client.ex:105: Goth.Client.retrieve_metadata_project/0
            (goth) lib/goth/config.ex:27: Goth.Config.init/1
            (stdlib) gen_server.erl:328: :gen_server.init_it/6
            (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,goth,{{shutdown,{failed_t
o_start_child,'Elixir.Goth.Config',{#{'__exception__' => true,'__struct__' => 'Elixir.HTTPoison.Error
',id => nil,reason => nxdomain},[{'Elixir.HTTPoison','request!',5,[{file,\"lib/httpoison.ex\"},{line,
66}]},{'Elixir.Goth.Client',retrieve_metadata_project,0,[{file,\"lib/goth/client.ex\"},{line,105}]},{
'Elixir.Goth.Config',init,1,[{file,\"lib/goth/config.ex\"},{line,27}]},{gen_server,init_it,6,[{file,\
"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}}
,{'Elixir.Goth',start,[normal,[]]}}}"}

Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_start_failure,goth,{{shutdown,{failed_to
_start_child,'Elixir.Goth.Config',{#{'__exception__' => true,'__struct__' => 'Elixir.HTTPoison.Er
peburrows commented 7 years ago

Your latest error looks like the first one, and most likely stems from not properly configuring goth with your credentials.

In the context of goth, the :nxdomain exception will be raised when you attempt to hit Google's metadata service when running outside of Google's network (the http://metadata.google.internal domain is not publicly accessible). Goth will only hit the metadata service if you haven't told goth about your credentials via the :json config.

I know you mentioned in a previous comment that you setup your credentials in your config, but can you double-check that you're still doing that?