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.

Project ID required even if running script from Compute Engine

See original GitHub issue
var datastore = require('@google-cloud/datastore')();

The line above used on compute engine (not app engine) will still throw the error below -

[Error: Sorry, we cannot connect to Google Cloud Services without a project ID. You may specify one with an environment variable named "GCL
OUD_PROJECT". See https://googlecloudplatform.github.io/google-cloud-node/#//docs/guides/authentication for a detailed guide on creating an
 authenticated connection.]

Yet in the documentation it says -

If you are running your app on Google Compute Engine, you won’t need to worry about supplying connection configuration options to @google-cloud/datastore— we figure that out for you.

That is not the case.

To reproduce create a google Compute engine instance and run a node.js script without a supplied project ID it will fail.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:25 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
dan-pettycommented, Mar 13, 2017

Getting this with 0.48.0 on App Engine nodejs runtime. var gcloud = require('google-cloud')({ projectId: 'my-project-id-here', keyFilename: './keyfile.json' });

Log error when trying to access gcs bucket:

“Error: Sorry, we cannot connect to 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.”

EDIT: Reverting to:

`"gcloud": "^0.37.2"`

resolves issue with no changes to code.

EDIT 2: Also resolved by:

var storage = require('@google-cloud/storage');
var gcs = storage({
  projectId: 'my-project-id-here',
  keyFilename: './keyfile.json'
});
1reaction
bjwatsoncommented, Mar 1, 2017

@stephenplusplus Is this a release blocking issue? It looks like several users have encountered it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using startup scripts on Linux VMs - Google Cloud
A startup script is a file that performs tasks during the startup process of a virtual machine (VM) instance. Startup scripts can apply...
Read more >
trying to find the current project id of the deployed python ...
I need to get the project-id through code to find out where it is deployed. I write a small python 3.7 script and...
Read more >
Google Cloud projects | Apps Script
Open the Google Cloud console Manage Resources page. Next to the Apps Script folder, copy the ID.
Read more >
google_project | Resources | hashicorp/google
Allows creation and management of a Google Cloud Platform project. ... The user or service account that is running Terraform when creating a...
Read more >
Get started with Cloud Firestore - Firebase
If you haven't already, create a Firebase project: In the Firebase ... your App Engine app (which is required if you use Cloud...
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