GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #936

New issue
Copy link
New issue
Copy link
Closed
Closed
setCredentials not setting projectId on ServiceOptions builder#936
Copy link

Description

@williamlang
williamlang
opened on Nov 30, 2017
Issue body actions

In 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.

Activity

  1. motibenyehuda commented on Apr 12, 2018

    @motibenyehuda
    motibenyehuda
    on Apr 12, 2018
    More actions

    Any luck with it??? i am suffering from the same issue...

  2. williamlang commented on Apr 12, 2018

    @williamlang
    williamlang
    on Apr 12, 2018
    Author
    More actions

    Workaround:

    BigQuery bigQuery = BigQueryOptions.newBuilder().setCredentials(credentials).setProjectId(projectId).build().getService();
    
  3. motibenyehuda commented on Apr 12, 2018

    @motibenyehuda
    motibenyehuda
    on Apr 12, 2018 via email
    More actions
    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> .
  4. motibenyehuda commented on Apr 12, 2018

    @motibenyehuda
    motibenyehuda
    on Apr 12, 2018 via email
    More actions
    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> .
  5. jabubake commented on Jun 15, 2018

    @jabubake
    jabubake
    on Jun 15, 2018
    Contributor
    More actions

    Submitted an issue on google-cloud-java, please follow the issue referenced.

  6. jabubake
    closed this as completedon Jun 15, 2018
  7. minherz
    added 3 commits that reference this issue on Nov 9, 2022

    chore(main): release 0.124.6 (#936)

    6425d36

    chore(main): release 0.124.6 (#936)

    6196840

    chore(main): release 0.124.6 (#936)

    df50943
  8. Shabirmean
    added a commit that references this issue on Nov 18, 2022

    deps: update dependency com.google.api.grpc:proto-google-cloud-aiplat…

    865ca9c
  9. gcf-merge-on-green
    added a commit that references this issue on Dec 20, 2022

    samples: migrate code from googleapis/java-aiplatform (#7451)

    24b693d
  10. Sita04
    added 2 commits that reference this issue on Feb 7, 2023

    deps: update dependency com.google.cloud:google-cloud-pubsub to v1.12…

    ad98f48

    chore(main): release 3.6.2 (#938)

    1c06f72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.