-
Notifications
You must be signed in to change notification settings - Fork 640
Closed
Description
Problem
After running gcloud beta auth application-default login I should be able to use google-cloud-node to access Google Cloud Platform services, but I can't. I must set the GCLOUD_PROJECT env var or explicitly pass a project ID to a client for google-cloud-node to work.
Steps to reproduce
- Install the Google Cloud SDK, git, Node.js and NPM
- Run
gcloud init, you'll be prompted to set a default project - Run
gcloud beta auth application-default loginand follow the OAuth 2.0 flow to login - Clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
- Run
cd nodejs-docs-samples/storage - Run
npm install - Run
node buckets.js list
Observe the error:
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/google-cloud-node/#//docs/guides/authentication
for a detailed guide on creating an authenticated connection.
- Modify
buckets.jsto explicitly pass in a project ID - Run
node buckets.js list - It works
- Undo your changes to
buckets.js - Set the
GCLOUD_PROJECTenv var to your project ID - Run
node buckets.js list - It works
Expected
- Open terminal
- Run
cd nodejs-docs-samples/storage - Run
gcloud beta auth application-default login - Run
node buckets.js list(No env vars are set, code does not pass project ID to client) - It works
Splaktar
Metadata
Metadata
Assignees
Labels
No labels