gcp-bigquery-client icon indicating copy to clipboard operation
gcp-bigquery-client copied to clipboard

failed to lookup address information: Name or service not known

Open mr-pascal opened this issue 8 months ago • 3 comments
trafficstars

Hey guys,

it's my first time using this library and I try to run a SELECT query, but even though I am authenticated I always run into authentication errors.

I have the following code snippet:

let client = gcp_bigquery_client::Client::from_application_default_credentials()
  .await
  .expect("Should create client!");

let sql = "...";

let query_request = QueryRequest::new(sql);
let query_response = self
    .client
    .job()
    .query(&self.project_id, query_request)
    .await?;

I am authenticated on my local machine via

gcloud auth application-default login
gcloud auth login

so the application default credentials are in place.

Nevertheless, every time .query(...) is run I get the following error:

Error: YupAuthError(HttpClientError(hyper_util::client::legacy::Error(Connect, ConnectError("dns error", Custom { kind: Uncategorized, error: "failed to lookup address information: Name or service not known" }))))
Error querying BigQuery: Authentication error (error: client error (Connect))

Caused by:
    0: client error (Connect)
    1: client error (Connect)
    2: dns error: failed to lookup address information: Name or service not known
    3: failed to lookup address information: Name or service not known

Do you know what I might be doing wrong here?

Thanks in advance 🙏🏻

mr-pascal avatar Mar 07 '25 17:03 mr-pascal

@lquerel might I ask your advice on that one? Since this is currently completely preventing me from doing anything with this library :-/

any help is highly appreciated. 🙏🏻

Already verified that it's not my DNS.

e.g. nslookup for the two domains "bigquery.googleapis.com" and "www.googleapis.com" works fine.

mr-pascal avatar Mar 11 '25 20:03 mr-pascal

Same issue 😔

ericschaal avatar Mar 13 '25 18:03 ericschaal

This is how I got it to work:

gcloud auth application-default login
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/.config/gcloud/application_default_credentials.json
# Fill these in...
export PROJECT_ID=
export DATASET_ID=
export TABLE_ID=
use gcp_bigquery_client::{env_vars};


let (ref project_id, ref dataset_id, ref table_id, ref gcp_sa_key) = env_vars();
let client = gcp_bigquery_client::Client::from_authorized_user_secret(gcp_sa_key).await?;

asweet-confluent avatar Aug 23 '25 21:08 asweet-confluent