L. Blanc
L. Blanc

Reputation: 2310

Can't access BigQuery from AppEngine java

I have an AppEngine account associated with a BigQuery project, but when I try to run a query, I get "Access Denied" in the response. I've setup an AppIdentityCredential like so:

 private static AppIdentityCredential getCredential() throws IOException, GeneralSecurityException {
    return new AppIdentityCredential(BigqueryScopes.BIGQUERY);
  }

  public static Bigquery createAuthorizedClient() throws IOException, GeneralSecurityException {
    return new Bigquery(TRANSPORT, JSON_FACTORY, getCredential());
  }

I also tried to make my AppEngine account a member of the BigQuery 'team' as directed here:https://developers.google.com/bigquery/docs/authorization#service-accounts-appengine

However, the teams page on Google's API console says "Invitation sent. Waiting for response" next to my AppEngine Service Account Name. I didn't receive an invitation (18 hours+) even though I'm the owner and sole team member on both the AppEngine and BigQuery sides. This leads me to think that BigQuery/AppEngine service integration is just broken, but if anyone sees something I've done wrong I would greatly appreciate the help.

Upvotes: 2

Views: 711

Answers (2)

L. Blanc
L. Blanc

Reputation: 2310

I retried a couple times creating new projects and doing the setup in different orders as +Gunasekaran's answer suggested. It worked eventually, but I'm not sure I could do it again let alone explain the correct order of steps.

Upvotes: 0

Gunasekaran R
Gunasekaran R

Reputation: 66

My guess would be your team tab in Console project is linked to app engine permissions, that is when it will display pending for mail address that you would like to provide access.

Please try to create new console project with Bigquery API enabled (Optionally GS API). After that add your appengine service account([email protected]) with can edit access.

Hope with that you can certainly do what you intend to do.

Also refer post by Michael Manoochehri for snippet.

Upvotes: 1

Related Questions