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 — When running in GCE, it should respect GOOGLE_APPLICATION_CREDENTIALS first · Issue #867 · googleapis/google-cloud-java

When running in GCE, it should respect GOOGLE_APPLICATION_CREDENTIALS first #867

New issue
Copy link
New issue
Copy link
Closed
Closed
When running in GCE, it should respect GOOGLE_APPLICATION_CREDENTIALS first#867
Copy link
Assignees
saturnism
Labels
auth

Description

@saturnism
saturnism
opened on Apr 6, 2016
Issue body actions

When running inside of GCE, it seems to be picking up machine credentials. I have credentials set via the env var GOOGLE_APPLICATION_CREDENTIALS

root@6a740ead3d2c:/# export
declare -x GOOGLE_APPLICATION_CREDENTIALS="/var/secrets/wise-coyote-827.json"
root@6a740ead3d2c:/# ls -lh $GOOGLE_APPLICATION_CREDENTIALS
-rw------- 1 1001 1001 2.3K Apr  6 17:47 /var/secrets/wise-coyote-827.json
root@6a740ead3d2c:/# cat $GOOGLE_APPLICATION_CREDENTIALS
{
  "type": "service_account",
...

When I start my app, it complains:

Apr 06, 2016 6:08:29 PM com.google.datastore.v1beta3.client.DatastoreFactory makeClient
INFO: Not using any credentials
18:08:29.859 [main] ERROR c.s.apollo.httpservice.HttpService - Uncaught exception on thread Thread[main,5,main], exiting
com.spotify.apollo.httpservice.LoadingException: Something went wrong
    at com.spotify.apollo.httpservice.HttpService.failure(HttpService.java:149) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpService.boot(HttpService.java:142) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpService.boot(HttpService.java:90) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpService.boot(HttpService.java:80) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpService.boot(HttpService.java:71) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.example.apollo.books.BooksService.main(BooksService.java:25) ~[books-service.jar:na]
Caused by: com.google.gcloud.datastore.DatastoreException: Not authorized.
    at com.google.gcloud.datastore.spi.DefaultDatastoreRpc.translate(DefaultDatastoreRpc.java:102) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.google.gcloud.datastore.spi.DefaultDatastoreRpc.lookup(DefaultDatastoreRpc.java:139) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.google.gcloud.datastore.DatastoreOptions.normalize(DatastoreOptions.java:116) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.google.gcloud.datastore.DatastoreOptions.access$300(DatastoreOptions.java:34) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.google.gcloud.datastore.DatastoreOptions$Builder.build(DatastoreOptions.java:81) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.google.gcloud.datastore.DatastoreOptions.defaultInstance(DatastoreOptions.java:167) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    at com.example.apollo.books.BooksService.init(BooksService.java:29) ~[books-service.jar:na]
    at com.spotify.apollo.environment.ApolloEnvironmentModule$ApolloEnvironmentImpl.initialize(ApolloEnvironmentModule.java:155) ~[apollo-environment-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpServiceModule.lambda$bindAppInit$1(HttpServiceModule.java:52) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpServiceModule.requestHandler(HttpServiceModule.java:58) ~[apollo-http-service-1.0.4.jar:1.0.4]
    at com.spotify.apollo.httpservice.HttpService.boot(HttpService.java:116) ~[apollo-http-service-1.0.4.jar:1.0.4]
    ... 4 common frames omitted
Caused by: com.google.datastore.v1beta3.client.DatastoreException: Not authorized.
    at com.google.datastore.v1beta3.client.RemoteRpc.makeException(RemoteRpc.java:126) ~[datastore-v1beta3-proto-client-1.0.0-beta.jar:na]
    at com.google.datastore.v1beta3.client.RemoteRpc.makeException(RemoteRpc.java:169) ~[datastore-v1beta3-proto-client-1.0.0-beta.jar:na]
    at com.google.datastore.v1beta3.client.RemoteRpc.call(RemoteRpc.java:89) ~[datastore-v1beta3-proto-client-1.0.0-beta.jar:na]
    at com.google.datastore.v1beta3.client.Datastore.lookup(Datastore.java:92) ~[datastore-v1beta3-proto-client-1.0.0-beta.jar:na]
    at com.google.gcloud.datastore.spi.DefaultDatastoreRpc.lookup(DefaultDatastoreRpc.java:137) ~[gcloud-java-datastore-0.1.7.jar:0.1.7]
    ... 13 common frames omitted

Activity

  1. mziccard commented on Apr 6, 2016

    @mziccard
    mziccard
    on Apr 6, 2016
    Contributor
    More actions

    Might be a dumb question: I see the variable is there for root, are you also starting your app as root? If not, is the variable there for the user that starts the app?

  2. aozarov commented on Apr 7, 2016

    @aozarov
    aozarov
    on Apr 7, 2016
    Contributor
    More actions

    Also, I wonder if it is using the expected projectId.

    @mziccard recently fixed #827 and I think the change to capture the project id from the credentials files,
    d17e325, was only merged after 0.1.7 was released.

  3. aozarov
    added
    auth
    on Apr 7, 2016
  4. saturnism commented on Apr 7, 2016

    @saturnism
    saturnism
    on Apr 7, 2016
    Author
    More actions

    Arie - I feel what you mentioned is probably it. I was able to 100% sure
    using the Json file but it still complained about being unauthorized. I'll
    try setting the project id (in env var?)

    Thanks!
    On Thu, Apr 7, 2016 at 4:30 AM Arie [email protected] wrote:

    Also, I wonder if it is using the expected projectId.

    @mziccard https://github.com/mziccard recently fixed #827
    #827 and I
    think the change to capture the project id from the credentials files,
    d17e325
    d17e325,
    was only merged after 0.1.7 was released.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly or view it on GitHub
    #867 (comment)

  5. mziccard commented on Apr 7, 2016

    @mziccard
    mziccard
    on Apr 7, 2016
    Contributor
    More actions

    @saturnism If you are using version 0.1.7 gcloud-java will set the project id from the "project_id" field in the JSON credentials pointed by GOOGLE_APPLICATION_CREDENTIALS. For future use: please notice that the "project_id" field has been recently introduced so your JSON credentials might not have it (depending on how recently you generated them).

    Setting the env var GCLOUD_PROJECT will do it in any case.

  6. mziccard commented on Apr 7, 2016

    @mziccard
    mziccard
    on Apr 7, 2016
    Contributor
    More actions

    Let me correct my last comment: I see you are actually using 0.1.7 and @aozarov is right, extracting project id from the JSON credentials pointed by GOOGLE_APPLICATION_CREDENTIALS IS NOT part of 1.7.0. This feature will be available in the next release.

  7. mziccard commented on Apr 13, 2016

    @mziccard
    mziccard
    on Apr 13, 2016
    Contributor
    More actions

    gcloud-java 0.2.0 is out. This version is capable of extracting project's id from GOOGLE_APPLICATION_CREDENTIALS (if set). Notice that we renamed both our groupId and our base package to com.google.cloud. Maven dependency is now:

    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>gcloud-java</artifactId>
      <version>0.2.0</version>
    </dependency>

    Can this issue be closed?

  8. saturnism
    closed this as completedon Apr 23, 2016
  9. saturnism commented on Apr 23, 2016

    @saturnism
    saturnism
    on Apr 23, 2016
    Author
    More actions

    thnx!

  10. JustinBeckwith
    assigned
    saturnism
    on Feb 1, 2021
  11. github-actions
    added 2 commits that reference this issue on Jun 21, 2022

    chore: skip formatting generated samples (#1456) (#867)

    318aa93

    chore: include generated samples dir (#867)

    43e0243
  12. github-actions
    added a commit that references this issue on Jul 14, 2022

    chore(deps): update dependency com.google.cloud:libraries-bom to v26 (#…

    44e6478
  13. github-actions
    added a commit that references this issue on Aug 18, 2022

    deps: update dependency com.google.cloud:google-cloud-storage to v2.1…

    9772dc2
  14. github-actions
    added 2 commits that reference this issue on Sep 15, 2022

    chore(main): release 3.0.6-SNAPSHOT (#867)

    f608f83

    chore(main): release 2.7.0 (#879)

    274a27c
  15. github-actions
    added 3 commits that reference this issue on Oct 4, 2022

    chore(main): release 2.4.6-SNAPSHOT (#867)

    49e0d05

    chore(main): release 1.5.6 (#866)

    2eed834

    chore(deps): update dependency com.google.cloud:libraries-bom to v26.…

    0f8e17d
  16. suztomo
    added 3 commits that reference this issue on Feb 1, 2023

    chore(main): release 2.8.3-SNAPSHOT (#867)

    cc8000f

    deps: update dependency com.google.cloud:grpc-gcp to v1.3.0 (#867)

    48ca222

    chore(main): release 3.0.5 (#880)

    cb88582
  17. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore(main): release 3.6.4-SNAPSHOT (#867)

    52e13e2
  18. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore(main): release 2.11.5 (#867)

    d4a95f1
  19. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore(main): release 3.6.4-SNAPSHOT (googleapis#867)

    6afe9ff
  20. suztomo
    added a commit that references this issue on Mar 30, 2026

    build(deps): update dependency com.google.cloud:google-cloud-shared-c…

    5827fe5
  21. lqiu96
    added a commit that references this issue on Apr 1, 2026

    build(deps): update dependency com.google.cloud:google-cloud-shared-c…

    e9ba65d
  22. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore(deps): update dependency com.google.cloud:libraries-bom to v23.…

    15c8050

    chore(deps): update dependency com.google.cloud:libraries-bom to v23.…

    991e0c7
  23. benjaminp
    added a commit that references this issue on Jul 13, 2026

    chore: regenerate README (googleapis#867)

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

Metadata

Metadata

Assignees

  • @saturnism
    saturnism

Labels

auth

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.