question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GCLOUD_PROJECT is deprecared in favor of GOOGLE_CLOUD_PROJECT + avoid using it at all

See original GitHub issue

The sample relies on the GCLOUD_PROJECT environment variable (see https://github.com/GoogleCloudPlatform/nodejs-getting-started/blob/master/2-structured-data/config.js#L27)

However, this variable is now deprecated and is not present in newer versions of the Node.js runtimes for App Engine.

Instead, developers should rely on the GOOGLE_CLOUD_PROJECT environment variable.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
zbjornsoncommented, May 28, 2019

best practice is to leverage the metadata server present on all GCP runtimes

google-auth-library (for Node.js) forks a process to run gcloud config to get the project ID, and last I looked, it prioritizes that over using the metadata server:

https://github.com/googleapis/google-auth-library-nodejs/blob/37bb8c7cd0a6501103274284d9cddd6816cc881e/src/auth/googleauth.ts#L177-L182

Forking a process isn’t safe on Linux because of https://github.com/nodejs/node/issues/25382; we routinely get crashes from the GCP client libs. I think that should be addressed before Google globally recommends not using an env var. An env var is also faster than making a req to the metadata server.

0reactions
fhinkelcommented, Sep 1, 2019

Obsolete with planned rewrite of the tutorial.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Environment Variables | Cloud Functions Documentation
GCLOUD_PROJECT, Reserved: The current GCP project ID (deprecated). GOOGLE_CLOUD_PROJECT, Reserved: Not set but reserved for internal use.
Read more >
How can I get current projectId inside Google Cloud Functions?
Current docs say GCP_PROJECT is the current env var, and that GCLOUD_PROJECT is deprecated. Not sure if you try now, whether the emulator...
Read more >
Configure your environment | Cloud Functions for Firebase
This approach makes configuration values available both at runtime and deploy time, and deployment is blocked unless all parameters have a valid value....
Read more >
Google Cloud (GCP) Classic Installation & Configuration
To configure Pulumi to interact with your Google Cloud project, set it with the pulumi config command using the project's ID:.
Read more >
gcloud app deploy force
Open up a Google Cloud project in the Google Cloud Console and enable the Kubernetes Engine API (as described in Deploying a containerized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found