Matias Barrios
Matias Barrios

Reputation: 5054

Hitting BigQuery from Golang app fails with 400 status code

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?

Upvotes: 3

Views: 3363

Answers (2)

DMe
DMe

Reputation: 7876

In case anyone runs into this while using the BigQuery Simba ODBC driver (since this is the only SO post that shows up for me for Cannot parse as CloudRegion), my error was caused by a missing ; at the end of a connection string property.

Upvotes: 0

Jose Gutierrez Paliza
Jose Gutierrez Paliza

Reputation: 1428

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.

Upvotes: 1

Related Questions