GeezerVison is showing github.com — setCredentials not setting projectId on ServiceOptions builder · Issue #936 · GoogleCloudPlatform/java-docs-samples
setCredentials not setting projectId on ServiceOptions builder #936DescriptionIn which file did you encounter the issue?
jdt://contents/google-cloud-core-1.12.0.jar/com.google.cloud/ServiceOptions.class
Did you change the file? If so, how?
No
Describe the issue
I used the example here:
https://cloud.google.com/bigquery/docs/authentication/service-account-file
// Instantiate a client.
BigQuery bigquery = BigQueryOptions.newBuilder().setCredentials(credentials).build().getService();
I verified that the properties set on the credentials object are not null.
The ServiceOptions builder object has a property called projectId that does not get set, despite the fact that the credentials property is set on the builder.
Either two fixes need to happen:
ServiceOptions.class:244 becomes
projectId = builder.projectId != null ? builder.getCredentials().getProjectId() : getDefaultProject();
Or,
setCredentials must set the projectId property on the builder. Activitymotibenyehuda commented on Apr 12, 2018 Any luck with it??? i am suffering from the same issue... williamlang commented on Apr 12, 2018 Workaround:
BigQuery bigQuery = BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
motibenyehuda commented on Apr 12, 2018 Thanks for replying so fast!!!
I tried it already. I working on it for the last 4 hours…
I am trying to write to BigQuery from local host (on production env is
working).
Still the projectId outside the credentials is empty (*"no_app_id"*).
changing it manually through the eclipse debugger working fine.
I am so lost consider using reflection to change the member,,,
Thanks anyway!
*From:* William Lang < [email protected]>
*Sent:* Thursday, April 12, 2018 9:00 PM
*To:* GoogleCloudPlatform/java-docs-samples <java-docs-samples@noreply.
github.com>
*Cc:* motibenyehuda < [email protected]>; Comment <
[email protected]>
*Subject:* Re: [GoogleCloudPlatform/java-docs-samples] setCredentials not
setting projectId on ServiceOptions builder ( #936)
Workaround:
BigQuery bigQuery =
BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
< #936 (comment)>,
or mute the thread
< https://github.com/notifications/unsubscribe-auth/AiChz-YPey2_C4PJrCL2m4Ozw5fdpzDKks5tn5Y4gaJpZM4Qv1iL>
. motibenyehuda commented on Apr 12, 2018 Oops...
I didn't extract correctly the project id.
working!!!
Thanks again,
Moti
…
On Thu, Apr 12, 2018 at 9:14 PM, Moti Ben - Yehuda < ***@***.***> wrote:
Thanks for replying so fast!!!
I tried it already. I working on it for the last 4 hours…
I am trying to write to BigQuery from local host (on production env is
working).
Still the projectId outside the credentials is empty (*"no_app_id"*).
changing it manually through the eclipse debugger working fine.
I am so lost consider using reflection to change the member,,,
Thanks anyway!
*From:* William Lang ***@***.***>
*Sent:* Thursday, April 12, 2018 9:00 PM
*To:* GoogleCloudPlatform/java-docs-samples ***@***.***
hub.com>
*Cc:* motibenyehuda ***@***.***>; Comment <
***@***.***>
*Subject:* Re: [GoogleCloudPlatform/java-docs-samples] setCredentials not
setting projectId on ServiceOptions builder ( #936)
Workaround:
BigQuery bigQuery = BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
< #936 (comment)>,
or mute the thread
< https://github.com/notifications/unsubscribe-auth/AiChz-YPey2_C4PJrCL2m4Ozw5fdpzDKks5tn5Y4gaJpZM4Qv1iL>
.
jabubake commented on Jun 15, 2018 Submitted an issue on google-cloud-java, please follow the issue referenced.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|