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

Unable to use with emulator and no/fake default credentials #1070

Closed
sdotz opened this issue Nov 3, 2016 · 9 comments
Closed

Unable to use with emulator and no/fake default credentials #1070

sdotz opened this issue Nov 3, 2016 · 9 comments
Assignees
Labels
api: bigtable Issues related to the googleapis/java-bigtable-hbase API.

Comments

@sdotz
Copy link

sdotz commented Nov 3, 2016

I'm trying to use this with the emulator and without providing valid (or any) gcloud default application credentials but having issues.

I am passing BIGTABLE_EMULATOR_HOST

First the lib complains of not having a project ID.
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project seeder: An exception occured while executing the Java class. null: InvocationTargetException: Could not find an appropriate constructor for com.google.cloud.bigtable.hbase1_2.BigtableConnection: Project ID must be supplied via google.bigtable.project.id -> [Help 1]

Is this relevant for the emulator? Let's plow forwards and give it that info.

Now I can see it outputs a line confirming it understood the BIGTABLE_EMULATOR_HOST.
BigtableOptions:75 - Connecting to the Bigtable emulator at bigtable:8820

but then...

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project seeder: An exception occured while executing the Java class. null: InvocationTargetException: Could not find an appropriate constructor for com.google.cloud.bigtable.hbase1_2.BigtableConnection: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information. -> [Help 1]

We need application_default_credentials. Why?

If I provide real credentials things work, but if I fake them, it fails to auth. Is there some way to configure things so we deal with the emulator only and are not depending on this file and not phoning home to google cloud? It seems like once it sees BIGTABLE_EMULATOR_HOST it should understand not to do any auth stuff with gcloud.

Thanks

@mbrukman
Copy link
Contributor

mbrukman commented Nov 3, 2016

If you are using the Bigtable emulator, you need to specify BIGTABLE_EMULATOR_HOST — your post talks about PUBSUB_EMULATOR_HOST instead, which is for another product: Google Cloud PubSub. Could that be the source of the issue?

See the docs for details.

@sdotz
Copy link
Author

sdotz commented Nov 3, 2016

Sorry, I pasted the wrong one. I am indeed using BIGTABLE_EMULATOR_HOST

@garye
Copy link
Contributor

garye commented Nov 3, 2016

Are you using the hbase layer?

@sdotz
Copy link
Author

sdotz commented Nov 3, 2016

Yes com.google.cloud.bigtable.hbase1_2.BigtableConnection

@garye
Copy link
Contributor

garye commented Nov 3, 2016

Oh I see from the error message that you are. Perhaps there is a code path there that does something with credentials before it looks for the emulator env variable.

As for the project id, the emulator needs one but it could be any arbitrary string.

@sdotz
Copy link
Author

sdotz commented Nov 3, 2016

I can't think of any path that does anything with the creds. It seems to happen when creating the BigtableSession. Do you know if the emulator flag is supposed to make it route around this somehow?

Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLust be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
    at com.google.bigtable.repackaged.com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:74)
    at com.google.bigtable.repackaged.com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:54)
    at com.google.cloud.bigtable.config.CredentialFactory.getApplicationDefaultCredential(CredentialFactory.java:207)
    at com.google.cloud.bigtable.config.CredentialFactory.getCredentials(CredentialFactory.java:112)
    at com.google.cloud.bigtable.grpc.io.CredentialInterceptorCache.getCredentialsInterceptor(CredentialInterceptorCache.java:94)
    at com.google.cloud.bigtable.grpc.BigtableSession.<init>(BigtableSession.java:272)
    at org.apache.hadoop.hbase.client.AbstractBigtableConnection.<init>(AbstractBigtableConnection.java:135)
    at org.apache.hadoop.hbase.client.AbstractBigtableConnection.<init>(AbstractBigtableConnection.java:104)
    at com.google.cloud.bigtable.hbase1_2.BigtableConnection.<init>(BigtableConnection.java:50)
    ... 14 more

@sdotz
Copy link
Author

sdotz commented Nov 3, 2016

Ah this was fixed in 0.9.3. I was on 0.9.2.

Fix was 99ab4a6 by Robert

The problem was in com.google.cloud.bigtable.config.BigtableOptions.Builder#applyEmulatorEnvironment
It was not setting null credentials and then later would default to default creds

@sdotz sdotz closed this as completed Nov 3, 2016
@sdotz
Copy link
Author

sdotz commented Nov 3, 2016

Thanks for the help!

@sduskis
Copy link
Contributor

sduskis commented Nov 3, 2016

Glad you sorted it out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/java-bigtable-hbase API.
Projects
None yet
Development

No branches or pull requests

4 participants