Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:nxdomain when calling Goth.Token.for_scope/1 #60

Closed
yuchunc opened this issue Jul 3, 2019 · 4 comments
Closed

:nxdomain when calling Goth.Token.for_scope/1 #60

yuchunc opened this issue Jul 3, 2019 · 4 comments

Comments

@yuchunc
Copy link

yuchunc commented Jul 3, 2019

I have been trying to auth with Google with Goth.Token.for_scope/1, and would get this error:

** (MatchError) no match of right hand side value: {:error, %HTTPoison.Error{id: nil, reason: :nxdomain}}
    (goth) lib/goth/client.ex:64: Goth.Client.get_access_token/3
    (goth) lib/goth/token.ex:151: Goth.Token.retrieve_and_store!/2

Looking in to the code base, I found it is trying to call http://metadata.google.internal, hence the :nxdomain error. I feel I missed something during the setup, but can't figure it out. How should I understand this error?

Thanks

@yuchunc
Copy link
Author

yuchunc commented Jul 19, 2019

Hi, sorry to be a nuisance, but any direction on this would be super helpful!

Thank you!!

@peburrows
Copy link
Owner

Sorry, I somehow completely missed this initial issue report!

Goth should only be falling back to hitting that internal Google metadata host when it can't find any other configuration. Have you configured Goth to use your service account json credentials, most likely via something like this in a config file:

# via a variable that contains the json
config :goth, json: credentials_json

# or, via an ENV var
config :goth, json: {:system, "MY_GCP_CREDENTIALS"}

(There are other ways to pass in your credentials, but those are the two most common.)

@yuchunc
Copy link
Author

yuchunc commented Jul 26, 2019

@peburrows
ahhh..... I think I had provided the wrong credential json. I deleted everything and started again last week, and "accidentally" provided the right cred json, and it works now.
Do you think it might be useful to have warning messages in dev environment when some part of the cred is missing?

Thanks for being patient with my issues.

@yuchunc yuchunc closed this as completed Jul 26, 2019
@vans163
Copy link

vans163 commented Aug 9, 2019

I think this is an error with how :inet_res works on newer erlang versions. 10.4.4 ERTS for example cannot parse a domain with a trailing /, but 10.2.2 ERTS can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants