0
votes

I am integrating Angular10, Firebase with BigQuery using '@google-cloud/bigquery'. I have created a function folder in my my project and in that I have added key json file which I got after generating Service account json on Google Cloud Console.

I have 2 datasets in my BigQuery dashboard whose source is Google Drive.But when I am trying to query these table I am getting error.

In my function folder I have index.js file where I am initializing my BigQuery client using following:

const bigqueryClient = new BigQuery({
    keyFilename:'./<name of key Json file from servie account>',
    scopes:['https://www.googleapis.com/auth/drive.readonly'],
    projectId:<Project-id>
  });

Error I am getting: "Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials."

Also if I remove projectId while initializing my big query client, following error is logged on console:

Sorry, we cannot connect to Cloud Services without a project\n ID. You may specify one with an environment variable named\n "GOOGLE_CLOUD_PROJECT"

Can anyone help me here?