Hitting BigQuery from Golang app fails with 400 status code

Viewed 424

I am trying to make a SQL query against BigQuery from a Golang applications. It does not work and throws the below error :

googleapi: Error 400: Cannot parse  as CloudRegion., badRequest

While debugging the request the library is doing I see this is the request in question:

curl --location --request POST 'https://bigquery.googleapis.com/bigquery/v2/projects/?????????/queries?alt=json&prettyPrint=false' \
--header 'Content-Type: application/json' \
--header 'User-Agent: google-api-go-client/0.5' \
--header 'X-Goog-Api-Client: gl-go/1.15.12 gccl/1.28.0' \
--data-raw '{"query":"SELECT distinct id from ?????","requestId":"request-20220308-70905360322000-0001","useLegacySql":false}

I cant find this error anywhere on the documentation. Can someone guide me in the right direction with this?

1 Answers

I know that the error you are facing has two possibilities, that could be happening to you.

  • The projectId is incorrect or is a non-existing project.

  • The authentication credentials are not set up correctly, for this you can see this part of the documentation.

Related