Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

BigQueryStorage: Connection API uses GOOGLE_APPLICATION_CREDENTIALS instead of credentials configured on instance.  #2531

Description

@jonathanswenson

Thanks for stopping by to let us know something could be better!

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    General, Core, and Other are also allowed as types
  2. OS type and version: Mac Ventura / Linux Ubuntu /
  3. Java version: 17 adoptium
  4. version(s): 2.22.0 2.19.1

Steps to reproduce

  1. create client with non-default credentials.
  2. run query using that takes longer than 10 seconds so that it falls out of the fast query pathway
  3. 💥

Code:

// don't have the GOOGLE_APPLICATION_CREDENTIALS env variable set.
BigQueryCredentials credentials = ServiceAccountCredentials.fromStream(inStream)

BigQueryOptions bigQueryOptions = BigQueryOptions.newBuilder()
    .setProjectId(projectId)
    .setCredentials(credentials)
            .setLocation(region)
            .build()
BigQuery bigquery = bigQueryOptions.getService()
ConneptionSettings connectionSettings = ConnectionSettings.newBuilder()
       .setUseReadAPI(false)
       .setRequestTimeout(10L)
       .setMaxResults(100L)
       .setUseQueryCache(true)
       .build();
Connection connection = bigquery.createConnection(connectionSettings);
String selectQuery = "<query that takes a little while and moves past the initial jobs.query timeout";
ListenableFuture<ExecuteSelectResponse> executeSelectFuture = connection.executeSelectAsync(selectQuery, ...);

Stack trace

The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

External references such as API reference guides

If the highThroughPut read path is hit, a BigQueryReadClient is created using the default BigQueryReadClient.create() method. here.

Because no credentials are passed, this looks for the GOOGLE_APPLICATION_CREDENTIALS instead of passing along the credentials that are configured for the bigquery client being used by the Connection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/java-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions