google-cloud-node: Error: Missing key, key or keyFile option must be provided!
While using gcloud on my own local server, I write:
var gcloud = require('gcloud');
var bucket;
bucket = gcloud.storage.bucket({
projectId: 'myProjectName',
keyFilename: 'resources/key.json',
bucketName: 'testnameorwhatever'
});
bucket.write('demo.txt', 'Hello World', function(err) {
var stuff = err || 'Created demo.txt'
console.log(stuff);
});
if I do specify the right path to the key, it gives this output (not thrown error, just console log): [Error: Missing key, key or keyFile option must be provided!] I do not understand this message. There is a key specified, and the path to it is right. I know that, as if I write the wrong keyFilename path, it throws ENOENT error 34. So, is it about the key description or something?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 21 (11 by maintainers)
Commits related to this issue
- chore(deps): update dependency eslint-plugin-node to v11 (#261) — committed to googleapis/google-cloud-node by renovate-bot 5 years ago
- feat: support streaming automl configs (#261) — committed to googleapis/google-cloud-node by yoshi-automation 5 years ago
- chore(deps): update dependency eslint-plugin-node to v11 (#261) — committed to googleapis/google-cloud-node by renovate-bot 5 years ago
- chore(deps): update dependency eslint-plugin-node to v11 (#261) — committed to googleapis/google-cloud-node by renovate-bot 5 years ago
- chore(deps): update dependency eslint-plugin-node to v11 (#261) — committed to googleapis/google-cloud-node by renovate-bot 5 years ago
- fix(deps): update dependency mathjs to v6 (#261) — committed to googleapis/google-cloud-node by renovate[bot] 5 years ago
- fix(deps): bump google-gax to 1.7.5 (#261) — committed to googleapis/google-cloud-node by JustinBeckwith 5 years ago
- chore: update license headers (#261) — committed to googleapis/google-cloud-node by JustinBeckwith 5 years ago
- fix(deps): update dependency mathjs to v6 (#261) — committed to googleapis/google-cloud-node by renovate[bot] 5 years ago
- fix(deps): bump google-gax to 1.7.5 (#261) — committed to googleapis/google-cloud-node by JustinBeckwith 5 years ago
- feat: support streaming automl configs (#261) — committed to googleapis/google-cloud-node by yoshi-automation 5 years ago
- chore(deps): update dependency eslint-plugin-node to v10 (#261) — committed to googleapis/google-cloud-node by renovate-bot 5 years ago
- fix(deps): bump google-gax to 1.7.5 (#261) — committed to googleapis/google-cloud-node by JustinBeckwith 5 years ago
- build: ignore proto files in test coverage (#261) — committed to googleapis/google-cloud-node by JustinBeckwith 5 years ago
- chore(deps): update dependency eslint-config-prettier to v4 (#261) — committed to googleapis/google-cloud-node by renovate[bot] 5 years ago
- fix: handle fallback option properly (#261) * changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version up... — committed to googleapis/google-cloud-node by yoshi-automation 4 years ago
- fix(deps): google-gax v2.17.0 with mTLS (#261) — committed to googleapis/google-cloud-node by bcoe 3 years ago
- chore: release 2.1.4 (#262) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.4](https://www.github.com/googleapis/nodejs-web-risk/compare/v2.1.3...v2.1.4) (2021-06-30) ### Bug Fixes ... — committed to googleapis/google-cloud-node by release-please[bot] 3 years ago
- chore(deps): update dependency sinon to v11 (#261) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Packag... — committed to googleapis/google-cloud-node by renovate-bot 3 years ago
- chore: release 3.2.8 (#261) :robot: I have created a release \*beep\* \*boop\* --- ### [3.2.8](https://www.github.com/googleapis/nodejs-billing-budgets/compare/v3.2.7...v3.2.8) (2021-08-17) ### Bug... — committed to googleapis/google-cloud-node by release-please[bot] 3 years ago
I’d say this issue comes down to a misunderstanding of the error message. The error itself is suggesting that a keyFile or key parameter should be specified, when really the error should suggest that they are likely using an invalid key file. Should we improve this err message?
I’m not proprietary of the project on the Google Cloud.
This is my view to get the json or the client and private keys. http://imgur.com/i4ZFKT4
Not dumb at all! There are a million things you can do in the Developers Console, it’s very easy to get lost.
I believe you are using a client ID for a webapp, where what we want is a service account. https://github.com/GoogleCloudPlatform/gcloud-node/#elsewhere step 4 should show how to do that.
I’m going to close as I was able to reproduce the same error with a webapp key, and remedy it with a service key. If you run into anything else, ask away!