google / google/googleapis.dart

The error message when `clientViaApplicationDefaultCredentials` fallbacks to reading `metadata` servers (and failing) is cryptic

Open
#572 3 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Dart
Stars
419
Forks
136
Avg merge
1h 21m
Merged PRs (30d)
5

Description

Context for this issue: https://github.com/invertase/dart_firebase_admin/issues/6

It appears that if a user tries to create a client with `clientViaApplicationDefaultCredentials`, yet have neither the environment nor `gcloud/application_default_credentials.json` setup, then `google_apis_auth` fallbacks to reaching out to `metadata.google.internal`.

The problem is that if that endpoint is unavailable (which is likely the case if the user made a mistake and _did_ want to login using the other options), then we end-up with a "Failed host lookup: 'metadata.google.internal'" error.

This is likely confusing, and a better error message could make it more intuitive to understand what the issue is.

Contributor guide

Open the contributing guide

Research direction

The issue names clientViaApplicationDefaultCredentials and the metadata.google.internal fallback, but no source file or test. Start by tracing that entry point and the credential fallback path. Done means an unavailable metadata endpoint produces an actionable message explaining the missing credentials and other login options.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.