SITUATION:
I follow this tutorial: https://cloud.google.com/nodejs/tutorials/bookshelf-on-compute-engine
Everything works fine until I do npm start
and go to:
I am met with the following text on the blank page:
Could not load the default credentials. Browse to https://developers.google.com/accounts/docs/application-default-credentials for more information.
Which makes no sense since I am using OAuth. I followed the link and read the page, but I have no GOOGLE-APPLICATION-CREDENTIALS
field anywhere, and nothing about it in the tutorial.
QUESTION:
Could you please reproduce the steps and tell me if you get the same result ?
(takes 5 minutes)
If not, what could I have done wrong ?
Yes, I had the same error. It's annoying cause Google Cloud Platform docs for their "getting started" bookshelf tutorial does not mention this anywhere. Which means that any new developer who tries this tutorial will see this error.
Read this: https://developers.google.com/identity/protocols/application-default-credentials
I fixed this issue by running:
gcloud auth application-default login
In order to run thisgcloud auth application-default login
Visit: https://cloud.google.com/sdk/install
1) You have to install sdk into your computer
2) That will enable you to run the code
3) Log in to your associated gmail account then you are good to go!
This will make you login, and after that you code locally will use that authentication.
I did that, and the message is now:
The project projectName does not exist or it does not contain an active App Engine application. Please visit http://console.developers.google.com to create a project or https://console.developers.google.com/appengine?project=projectName to add an App Engine application. Note that the app must not be disabled.
THIS MAKES NO SENSE, I AM USING THE COMPUTE ENGINE AND THIS IS A TUTORIAL FOR THE COMPUTE ENGINE :(To use the gloud CLI for these tutorials you need to configure your default app in the CLI level. You may have missed this step. I'm sure you have already created a "Project" in GCP, take that ProjectID and run this:
gcloud config set project [YOUR_PROJECT_ID]
. This will configure your gloud CLI to use the correct Project. Check out: cloud.google.com/nodejs/getting-started/tutorial-appSetting process.env.GOOGLE_APPLICATION_CREDENTIALS = "<PATH_TO_SERVICE_ACCOUNT_JSON_FILE>" worked for me.
@newbreedofgeek 'gcloud' is not recognized as an internal or external command, operable program or batch file.
@GabrielWamunyu Does it work for you w/o the SDK? in production?