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

GCE detection failed in getApplicationDefault #103

Open
fatho opened this issue Apr 10, 2018 · 0 comments
Open

GCE detection failed in getApplicationDefault #103

fatho opened this issue Apr 10, 2018 · 0 comments

Comments

@fatho
Copy link

fatho commented Apr 10, 2018

We have an application using gogol running inside a GCE instance, using getApplicationDefault for obtaining the credentials. Recently, it falsely assumed that it was not running on GCE and failed with a MissingFileError "/home/.../.config/gcloud/application_default_credentials.json". Since we were relying on the instance-based authentication with the associated service account, that credential file is supposed to be missing.

It seems that the GCE detection works by sending a request to metadata.google.internal with a hard-coded timeout of 1 second. Our suspicion is that this request took longer than a second once due to a temporary network fluke. (As this was the only time it happened so far in more than two months of running this application.)

This could be alleviated by implementing one or more of the following ideas

  1. having a way of configuring the timeout,
  2. adding a possibility for forcing this check to return True (similar to the existing way of forcing it to False by using the NO_GCE_CHECK environment variable),
  3. adding a constant for FromMetadata "default" which is the Credentials value used in the case when it's running on GCE, or
  4. documenting that getApplicationDefault may unexpectedly fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants