Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Let users provide Project Id via GOOGLE_APPLICATION_CREDENTIALS #638

@stephenplusplus

Description

@stephenplusplus
Copied from original issue: googleapis/google-cloud-node#2787

@JustinBeckwith
January 8, 2018 9:58 PM

Today in cloudcats I am providing the ProjectId via the PROJECT_ID env var. I also have to provide a keyfile, which I was passing into the code. In an effort to make things a little more smooth on the config side, I tried to use GOOGLE_APPLICATION_CREDENTIALS instead of defining PROJECT_ID and the keyfile. The projectId is inside of my keyfile - but we still seem to require the ProjectId along with the key file :(

beckwith-macbookpro:web beckwith$ npm start

> [email protected] start /Users/beckwith/Code/cloudcats/web
> GOOGLE_APPLICATION_CREDENTIALS=keyfile.json node server.js

info: Server running at: http://0.0.0.0:8080
ERROR:@google-cloud/trace-agent: Unable to acquire the project number from metadata service. Please provide a valid project number as an env. variable, or through config.projectId passed to start(). Error: getaddrinfo ENOTFOUND metadata.google.internal metadata.google.internal:80
ERROR:@google-cloud/debug-agent: The project ID could not be determined: getaddrinfo ENOTFOUND metadata.google.internal metadata.google.internal:80

Can we just read the projectId from the keyfile?

Metadata

Metadata

Assignees

Labels

api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.external fixpriority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions