Skip to content

Can we make gcloud-node auto-detect the projectId if it's in a special environment? #974

Description

@jgeewax

Special environment = Compute Engine or App Engine via Managed VMs?

Activity

  1. stephenplusplus commented on Nov 30, 2015

    @stephenplusplus
    Contributor

    App Engine via Managed VMs

    I believe so, because it's available as an env var, right? GAE_LONG_APP_ID, possibly.

    Compute Engine

    I believe you have to hit the metadata server, which complicates this for us, as that is an async operation.

    We talked about this in #570 (shortcut: #570 (comment)).

    What we came up with was... for the same code to go from a dev environment where a project ID will always be required (can't be autodetected) to a production requirement (where it can be autodetected), the user would already have been providing the project ID in dev, only to remove it when pushing to production for the benefit of magic autodetection.

    So the resolution was to just require it explicitly, but honor a generic env var "GCLOUD_PROJECT_ID". I'm not sure what happened to that... I don't think we ever did honor that env var or document it. But then this issue came along, and afaik, it doesn't look like we decided on one yet?

    If we can agree on just a single env var like "GCLOUD_PROJECT_ID", do you still think that's a good way to go for all the reasons we discussed in #570?

  2. jgeewax commented on Nov 30, 2015

    @jgeewax
    ContributorAuthor

    Effectively we're saying to run this to start your app, and this problem goes away, right ?

    $ export GCLOUD_PROJECT=`curl -L http://metadata.google.internal/computeMetadata/v1beta1/project/project-id`
    $ node
  3. stephenplusplus commented on Nov 30, 2015

    @stephenplusplus
    Contributor

    Yeah that would definitely work (naming of "GCLOUD_PROJECT" tbd).

  4. jgeewax commented on Nov 30, 2015

    @jgeewax
    ContributorAuthor

    Sure -- I think that was the latest proposal in that issue on gcloud-common-private.

  5. stephenplusplus commented on Nov 30, 2015

    @stephenplusplus
    Contributor

    Okay cool, I'll get that supported asap!

  6. added a commit that references this issue on Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions