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 — Datastore client not getting ProjectID from env · Issue #1092 · googleapis/google-cloud-node

Datastore client not getting ProjectID from env  #1092

New issue
Copy link
New issue
Copy link
Closed
Closed
Datastore client not getting ProjectID from env #1092
Copy link
Assignees
callmehiphop
Labels
api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@thesandlord
thesandlord
opened on Jan 27, 2016
Issue body actions

It looks like Datastore client is not getting the projectID from the env automatically.

var pubsub = gcloud.pubsub();

This works fine, but:

var dataset = gcloud.datastore.dataset();

returns:

Error: Sorry, we cannot connect to Google Cloud Services without a project ID. You may specify one with an environment variable named "GCLOUD_PROJECT". See https://googlecloudplatform.github.io/gcloud-node/#/authentication for a detailed guide on creating an authenticated connection.

This fixes the problem

var dataset = gcloud.datastore.dataset({projectId: process.env.GCLOUD_PROJECT});

Activity

Next
  1. stephenplusplus commented on Jan 27, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 27, 2016
    Contributor
    More actions

    Good catch, thanks for letting us know. PR incoming!

  2. stephenplusplus
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: datastoreIssues related to the Datastore API.
    on Jan 27, 2016
  3. thesandlord commented on Jan 27, 2016

    @thesandlord
    thesandlord
    on Jan 27, 2016
    Author
    More actions

    im not sure if other clients also have this problem. I though they all extend the same base class?

  4. stephenplusplus commented on Jan 27, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 27, 2016
    Contributor
    More actions

    I checked, all of the other APIs do it.

    @callmehiphop can you think of a way we can move the normalizing to the Service constructor?

  5. callmehiphop
    closed this as completedin #1093on Jan 28, 2016
  6. callmehiphop commented on Jan 28, 2016

    @callmehiphop
    callmehiphop
    on Jan 28, 2016
    Contributor
    More actions

    @stephenplusplus we should be able to just normalize them in the Service constructor, no?

  7. stephenplusplus commented on Jan 28, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 28, 2016
    Contributor
    More actions

    I think there might be an issue with double-instantion?

    On Thu, Jan 28, 2016, 11:01 AM Dave Gramlich [email protected]
    wrote:

    @stephenplusplus https://github.com/stephenplusplus we should be able
    to just normalize them in the Service constructor, no?

    —
    Reply to this email directly or view it on GitHub
    #1092 (comment)
    .

  8. stephenplusplus
    reopened this on Jan 28, 2016
  9. callmehiphop commented on Jan 28, 2016

    @callmehiphop
    callmehiphop
    on Jan 28, 2016
    Contributor
    More actions

    Service.call(...) only gets called once IIRC - after a service class has been instantiated.. right?

  10. stephenplusplus commented on Jan 29, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 29, 2016
    Contributor
    More actions

    Using this as an example: https://github.com/GoogleCloudPlatform/gcloud-node/blob/30817fcc10195da0136baefeb38b225986fb1c7e/lib/storage/index.js#L87-L90

    if (!(this instanceof Storage)) {
      options = util.normalizeArguments(this, options);
      return new Storage(options);
    }

    Why do we only normalize if it's not an instance of Storage?

  11. stephenplusplus commented on Jan 29, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 29, 2016
    Contributor
    More actions

    Related: #845 (comment)

  12. callmehiphop commented on Jan 29, 2016

    @callmehiphop
    callmehiphop
    on Jan 29, 2016
    Contributor
    More actions

    Why do we only normalize if it's not an instance of Storage?

    If the current context is not an instance of a service (e.g. Storage), that implies that the context is probably gcloud, which is where we store global config.

  13. stephenplusplus commented on Jan 29, 2016

    @stephenplusplus
    stephenplusplus
    on Jan 29, 2016
    Contributor
    More actions

    So I'm wondering, since we only normalize under that condition, how do we move that logic to the Service constructor?

  14. callmehiphop commented on Jan 29, 2016

    @callmehiphop
    callmehiphop
    on Jan 29, 2016
    Contributor
    More actions

    So I'm wondering, since we only normalize under that condition, how do we move that logic to the Service constructor?

    Ahh right, not sure if there's a way around that.. we might have to re-think things a little bit if we want to try and refactor that logic into the Service class.

  15. 3 remaining items

  16. JustinBeckwith
    assigned
    callmehiphop
    on Feb 1, 2021
  17. miguelvelezsa
    added a commit that references this issue on Jan 28, 2026

    docs: adds OR sample (#1092)

    4d7eb41
  18. sofisl
    added 2 commits that reference this issue on Feb 3, 2026

    chore(deps): update actions/checkout action to v3 (#1392) (#1092)

    d4c2cf1

    docs: adds OR sample (#1092)

    41b87e3
  19. sofisl
    added a commit that references this issue on Feb 17, 2026

    docs: adds OR sample (#1092)

    91435eb
  20. sofisl
    added 3 commits that reference this issue on Feb 24, 2026

    feat!: Drop Node 8 support (#1006)

    2500a99

    chore(deps): update dependency @types/uuid to v7 (#1092)

    2f7e02e

    feat(secrets): begin migration to secret manager from keystore (#1092)

    aac78de
  21. GautamSharda
    added 2 commits that reference this issue on Mar 5, 2026

    chore: release 9.4.0 (#1092)

    7754521

    chore: start tracking obsolete files (#1092)

    988d25e
  22. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    chore(deps): update dependency @types/uuid to v7 (googleapis#1092)

    029ec3b
  23. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    test: Add autogenerated tests to prepare for a refactor PR (#1092)

    8f19c7f

    test: Add autogenerated tests to prepare for a refactor PR (#1092)

    4476403
  24. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    test: Add autogenerated tests to prepare for a refactor PR (#1092)

    0269805
  25. thiyaguk09
    added a commit that references this issue on May 5, 2026

    test: Add autogenerated tests to prepare for a refactor PR (googleapi…

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

Metadata

Metadata

Assignees

  • @callmehiphop
    callmehiphop

Labels

api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

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.