{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/570","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/570/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/570/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/570/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/570","id":74697797,"number":570,"title":"Raise a helpful error if projectID is missing when making a request?","user":{"login":"jgeewax","id":112928,"avatar_url":"https://avatars.githubusercontent.com/u/112928?v=3","gravatar_id":"","url":"https://api.github.com/users/jgeewax","html_url":"https://github.com/jgeewax","followers_url":"https://api.github.com/users/jgeewax/followers","following_url":"https://api.github.com/users/jgeewax/following{/other_user}","gists_url":"https://api.github.com/users/jgeewax/gists{/gist_id}","starred_url":"https://api.github.com/users/jgeewax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgeewax/subscriptions","organizations_url":"https://api.github.com/users/jgeewax/orgs","repos_url":"https://api.github.com/users/jgeewax/repos","events_url":"https://api.github.com/users/jgeewax/events{/privacy}","received_events_url":"https://api.github.com/users/jgeewax/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/datastore","name":"datastore","color":"0052cc"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/milestones/5","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/milestones/Datastore%20Future","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/milestones/5/labels","id":961383,"number":5,"title":"Datastore Future","description":"","creator":{"login":"jgeewax","id":112928,"avatar_url":"https://avatars.githubusercontent.com/u/112928?v=3","gravatar_id":"","url":"https://api.github.com/users/jgeewax","html_url":"https://github.com/jgeewax","followers_url":"https://api.github.com/users/jgeewax/followers","following_url":"https://api.github.com/users/jgeewax/following{/other_user}","gists_url":"https://api.github.com/users/jgeewax/gists{/gist_id}","starred_url":"https://api.github.com/users/jgeewax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgeewax/subscriptions","organizations_url":"https://api.github.com/users/jgeewax/orgs","repos_url":"https://api.github.com/users/jgeewax/repos","events_url":"https://api.github.com/users/jgeewax/events{/privacy}","received_events_url":"https://api.github.com/users/jgeewax/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":12,"state":"open","created_at":"2015-02-02T13:22:17Z","updated_at":"2015-05-14T12:35:25Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-05-09T15:33:13Z","updated_at":"2015-05-14T17:18:40Z","closed_at":null,"body":"Right now, if I run the following code on an unconfigured machine, I get a scary back-end error...\r\n\r\n```javascript\r\n// (We're not running on App Engine or Compute Engine).\r\nvar gcloud = require('gcloud');\r\nvar dataset = gcloud.datastore.dataset();  // <-- Here is the issue (projectId === undefined)\r\n\r\ndataset.get(datastore.key(['Person', 1], function(result) {\r\n  console.log(result);\r\n});\r\n```\r\n\r\nSeems like if we can't auto-discover the project ID or credentials, we fail with a very long error.\r\n\r\nCould we update things so that we raise a specific exception saying \"You tried to make a request with a null project ID, meaning we couldn't figure out the project ID and you also didn't tell us the project ID...\""},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/102106818","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/issues/570#issuecomment-102106818","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/570","id":102106818,"user":{"login":"stephenplusplus","id":723048,"avatar_url":"https://avatars.githubusercontent.com/u/723048?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenplusplus","html_url":"https://github.com/stephenplusplus","followers_url":"https://api.github.com/users/stephenplusplus/followers","following_url":"https://api.github.com/users/stephenplusplus/following{/other_user}","gists_url":"https://api.github.com/users/stephenplusplus/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenplusplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenplusplus/subscriptions","organizations_url":"https://api.github.com/users/stephenplusplus/orgs","repos_url":"https://api.github.com/users/stephenplusplus/repos","events_url":"https://api.github.com/users/stephenplusplus/events{/privacy}","received_events_url":"https://api.github.com/users/stephenplusplus/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T17:18:40Z","updated_at":"2015-05-14T17:18:40Z","body":"The actual API call that was made in your example was:\r\n\r\n```js\r\n{ method: 'POST',\r\n  uri: 'https://www.googleapis.com/datastore/v1beta2/datasets/{projectId}/lookup',\r\n  headers: { 'Content-Type': 'application/x-protobuf' } }\r\n```\r\n\r\n(note the `{projectId}`)\r\n\r\nEven if you ran it in an environment where google-auth-library could have detected the projectId and credentials, it still would fail because that placeholder was never replaced.\r\n\r\nBefore I figure out the right way to solve this, I want to see if we should stand by this: our docs say a `projectId` is always required. The project id can be detected by google-auth-library, but we still require it in our library to form API calls to the right path, among various other places.\r\n\r\nDo we want to push for a completely projectId-configuration-free experience? I can try to extract the logic from the auth library, or send a PR to expose it.\r\n\r\nHowever, if we're okay to require `projectId`, then I'll just throw if we don't get one or one wasn't inherited."}}