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

Error when executing bq command from google-cloud-cli version 469.0.0 #290

Open
totem3 opened this issue Apr 5, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@totem3
Copy link
Sponsor Collaborator

totem3 commented Apr 5, 2024

What happened?

Starting with version 469.0.0 of google-cloud-cli, executing the bq command results in the following error:

bq --project_id test --api http://localhost:9051 ls
BigQuery error in ls operation: Got 500 response from discovery url: http://host.docker.internal:9051/$discovery/rest?version=v2

I tested the difference between versions using the docker image of google-cloud-cli. It works fine up until version 468.0.0, but does not work from version 469.0.0.

❯ docker run gcr.io/google.com/cloudsdktool/google-cloud-cli:468.0.0 bq --project_id test --api http://host.docker.internal:9051 ls
                  datasetId
 -------------------------------------------
  test1
  test
  bqjob_r4a554d13245e76d_0000018eac057299_1

❯ docker run gcr.io/google.com/cloudsdktool/google-cloud-cli:469.0.0 bq --project_id test --api http://host.docker.internal:9051 ls
BigQuery error in ls operation: Got 500 response from discovery url: http://host.docker.internal:9051/$discovery/rest?version=v2

(I use Docker Desktop on Mac and run emulator on the host machine, so endpoint is host.docker.internal. Some options are omitted)

The error occurs not just with the bq ls command, but with other commands like query as well.

Server version is current HEAD: 3f8779e

What did you expect to happen?

I expected it to work correctly and return a response, just like it did when executed with version 468.0.0.

How can we reproduce it (as minimally and precisely as possible)?

  • Install the latest version of google-cloud-sdk (currently 471.0.0).
  • Execute the bq command against an emulator.

Anything else we need to know?

workaround

As a workaround, you can:

  • Downgrade google-cloud-cli to version 468 or earlier.
  • or Download the discovery JSON and pass it using the --discovery_file option.
curl -sqo old_discovery_file.json 'https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest'
bq --discovery_file=old_discovery_file.json --project_id local_project --api http://host.docker.internal:9051 ls
           datasetId
 ------------------------------
  test

cause

Discovery API Endpoint has been changed.

We need to create a new handler to handle the new API

@totem3 totem3 added the bug Something isn't working label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant