Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Missing key, key or keyFile option must be provided! #261

Closed
Lordink opened this issue Oct 17, 2014 · 21 comments
Closed

Error: Missing key, key or keyFile option must be provided! #261

Lordink opened this issue Oct 17, 2014 · 21 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@Lordink
Copy link

Lordink commented Oct 17, 2014

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?

@stephenplusplus
Copy link
Contributor

Which version of gcloud-node are you using?

@Lordink
Copy link
Author

Lordink commented Oct 17, 2014

the latest one, I guess. 0.8.1

@stephenplusplus
Copy link
Contributor

Can you verify that in yourproject/node_modules/gcloud-node/package.json? :)

@Lordink
Copy link
Author

Lordink commented Oct 17, 2014

Yeah, here is a fraction of it:

{
  "name": "gcloud",
  "version": "0.8.1",
  "author": {
    "name": "Google Inc."
  },
  "description": "Google Cloud APIs Client Library for Node.js",
...

@stephenplusplus
Copy link
Contributor

Thanks, I'll play around and try to find the 🐛

@Lordink
Copy link
Author

Lordink commented Oct 17, 2014

Just in case I am dumb and use the wrong key, my key json has these fields in it:

{"web":{"auth_uri":"https://accounts.google.com/o/oauth2/auth", "client_secret": ..., "token_uri":...

and so on. Is that the right key? :)

@stephenplusplus
Copy link
Contributor

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!

@ryanseys
Copy link
Contributor

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?

@ryanseys
Copy link
Contributor

Seems the error is created in gapitoken so we have no control over the error message, unless we do some of our own sanity checking when passing in the key / key file.

@thebergamo
Copy link

I'm try to use the same feature and I've the same error.

Have a fix to this problem?

@stephenplusplus
Copy link
Contributor

@marcacohen did you try #261 (comment)?

@thebergamo
Copy link

Nothing... I try to pass the client_email and the private_key manual, but I recive this error:

12176:error:0906D06C:PEM routines:PEM_read_bio:no start line:openssl\crypto\pem\pem_lib.c:703:Expecting: ANY PRIVATE KEY

@stephenplusplus
Copy link
Contributor

You generated a service account JSON key from the developer's console, and it looked like:

{
  "private_key_id": "...",
  "private_key": "...",
  "client_email": "...@developer.gserviceaccount.com",
  "client_id": "....apps.googleusercontent.com",
  "type": "service_account"
}

You instantiated gcloud like:

require('gcloud')({
  credentials: {
    private_key: '...',
    client_email: '...@developer.gserviceaccount.com'
  }
});

and got that error?

More code that shows what you're doing and full stack traces would help me debug.

@thebergamo
Copy link

My JSON not is in this format.

The private_key have only ~16 chars. I'm almost on madness to solve this problem. :(

@stephenplusplus
Copy link
Contributor

How did you get the key? And as mentioned before, code snippets of what's causing the error and a stack trace would help us alleviate the madness :)

@thebergamo
Copy link

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

var gcloud = require('gcloud');
var storage = gcloud.storage({
  projectId: 'teste-edco',
  keyFilename: __dirname +'/client.json'
  /*credentials: {
    client_email: 'email',
    private_key: '26chars_key'
  }*/
});

@thebergamo
Copy link

When I try to use only the credentials I get the error:

21188:error:0906D06C:PEM routines:PEM_read_bio:no start line:openssl\crypto\pem\pem_lib.c:703:Expecting: ANY PRIVATE KEY

crypto.js:398
  var ret = this._binding.sign(toBuf(key));
                          ^
Error: SignFinal error
    at Sign.sign (crypto.js:398:27)
    at createRS256Signature (C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\node_modules\gapitoken\node_modules\jws\index.js:75:58)
    at jwsRS256Sign (C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\node_modules\gapitoken\node_modules\jws\index.js:68:21)
    at Object.jwsSign [as sign] (C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\node_modules\gapitoken\node_modules\jws\index.js:32:12)
    at GAPI.getAccessToken (C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\node_modules\gapitoken\gapitoken.js:57:25)
    at GAPI.getToken (C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\node_modules\gapitoken\gapitoken.js:36:14)
    at C:\PROG\Work\POCs\ebclient2-plugin-client-cc-youtube\testes\node_modules\gcloud\lib\common\connection.js:211:10
    at process._tickCallback (node.js:419:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)

@silvolu
Copy link
Contributor

silvolu commented Nov 5, 2014

From the screenshot, it looks like you have a Client ID for native apps and an API Key for a server app. What you need is a Client ID for a Service Account, so you should ask the owner of your project to create one.

@thebergamo
Copy link

@silvolu, I try these for one project I'm owner, but yet I have the same problems

@silvolu
Copy link
Contributor

silvolu commented Nov 5, 2014

When you use the project you own, are you using a Client ID for service accounts? In other words, if you navigate to the Google Developers Console, choose the project and navigate to the Credentials tab, does it say Service Account (conta de serviço according to Google Translate) over the Client ID that you're using?

@thebergamo
Copy link

THANKS VERY MUCH!

Thanks again, and again for the patience. Now I can go to the next step 👻

@jgeewax jgeewax added auth type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 2, 2015
@jgeewax jgeewax added this to the Storage Stable milestone Feb 2, 2015
@jgeewax jgeewax added the api: storage Issues related to the Cloud Storage API. label Feb 2, 2015
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 6, 2020
sofisl pushed a commit that referenced this issue Nov 11, 2022
* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* chore(nodejs_templates): add script logging to node_library populate-secrets.sh

Co-authored-by: Benjamin E. Coe <bencoe@google.com>

Source-Author: BenWhitehead <BenWhitehead@users.noreply.github.com>
Source-Date: Wed Jun 10 22:24:28 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: e7034945fbdc0e79d3c57f6e299e5c90b0f11469
Source-Link: googleapis/synthtool@e703494
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^10.0.0` -> `^11.0.0`](https://renovatebot.com/diffs/npm/sinon/10.0.0/11.1.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/compatibility-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/11.1.0/confidence-slim/10.0.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>sinonjs/sinon</summary>

### [`v11.1.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#&#8203;1110--2021-05-25)

[Compare Source](https://togithub.com/sinonjs/sinon/compare/v11.0.0...31be9a5d5a4762ef01cb195f29024616dfee9ce8)

\==================

-   Add sinon.promise() implementation ([#&#8203;2369](https://togithub.com/sinonjs/sinon/issues/2369))
-   Set wrappedMethod on getters/setters ([#&#8203;2378](https://togithub.com/sinonjs/sinon/issues/2378))
-   \[Docs] Update fake-server usage & descriptions ([#&#8203;2365](https://togithub.com/sinonjs/sinon/issues/2365))
-   Fake docs improvement ([#&#8203;2360](https://togithub.com/sinonjs/sinon/issues/2360))
-   Update nise to 5.1.0 (fixed [#&#8203;2318](https://togithub.com/sinonjs/sinon/issues/2318))

### [`v11.0.0`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#&#8203;1100--2021-05-24)

[Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.1...v11.0.0)

\==================

-   Explicitly use samsam 6.0.2 with fix for [#&#8203;2345](https://togithub.com/sinonjs/sinon/issues/2345)
-   Update most packages ([#&#8203;2371](https://togithub.com/sinonjs/sinon/issues/2371))
-   Update compatibility docs ([#&#8203;2366](https://togithub.com/sinonjs/sinon/issues/2366))
-   Update packages (includes breaking fake-timers change, see [#&#8203;2352](https://togithub.com/sinonjs/sinon/issues/2352))
-   Warn of potential memory leaks ([#&#8203;2357](https://togithub.com/sinonjs/sinon/issues/2357))
-   Fix clock test errors

### [`v10.0.1`](https://togithub.com/sinonjs/sinon/blob/master/CHANGELOG.md#&#8203;1001--2021-04-08)

[Compare Source](https://togithub.com/sinonjs/sinon/compare/v10.0.0...v10.0.1)

\==================

-   Upgrade sinon components (bumps y18n to 4.0.1)
-   Bump y18n from 4.0.0 to 4.0.1

</details>

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-grafeas).
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`^16.0.0` -> `^18.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/16.18.3/18.11.9) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/compatibility-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/18.11.9/confidence-slim/16.18.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-service-directory).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yNDEuMTEiLCJ1cGRhdGVkSW5WZXIiOiIzNC4xMS4xIn0=-->
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [jsdoc](https://togithub.com/jsdoc/jsdoc) | [`^3.6.3` -> `^4.0.0`](https://renovatebot.com/diffs/npm/jsdoc/3.6.11/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/compatibility-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/confidence-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>jsdoc/jsdoc</summary>

### [`v4.0.0`](https://togithub.com/jsdoc/jsdoc/blob/HEAD/CHANGES.md#&#8203;400-November-2022)

[Compare Source](https://togithub.com/jsdoc/jsdoc/compare/3.6.11...084218523a7d69fec14a852ce680f374f526af28)

-   JSDoc releases now use [semantic versioning](https://semver.org/). If JSDoc makes
    backwards-incompatible changes in the future, the major version will be incremented.
-   JSDoc no longer uses the [`taffydb`](https://taffydb.com/) package. If your JSDoc template or
    plugin uses the `taffydb` package, see the
    [instructions for replacing `taffydb` with `@jsdoc/salty`](https://togithub.com/jsdoc/jsdoc/tree/main/packages/jsdoc-salty#use-salty-in-a-jsdoc-template).
-   JSDoc now supports Node.js 12.0.0 and later.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-media-translation).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNy4xIiwidXBkYXRlZEluVmVyIjoiMzQuMTcuMSJ9-->
sofisl pushed a commit that referenced this issue Nov 11, 2022
* chore(docs): update code of conduct of synthtool and templates

Source-Author: Christopher Wilcox <crwilcox@google.com>
Source-Date: Thu Oct 22 14:22:01 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 5f6ef0ec5501d33c4667885b37a7685a30d41a76
Source-Link: googleapis/synthtool@5f6ef0e

* build(node): update testing matrix

Source-Author: Benjamin E. Coe <bencoe@google.com>
Source-Date: Thu Oct 22 22:32:52 2020 -0500
Source-Repo: googleapis/synthtool
Source-Sha: b7413d38b763827c72c0360f0a3d286c84656eeb
Source-Link: googleapis/synthtool@b7413d3

* build(node): don't run prepare during smoke test

Source-Author: Benjamin E. Coe <bencoe@google.com>
Source-Date: Fri Oct 23 17:27:51 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: a783321fd55f010709294455584a553f4b24b944
Source-Link: googleapis/synthtool@a783321

* build(node): cleanup production deps before installing dev/production

Source-Author: Benjamin E. Coe <bencoe@google.com>
Source-Date: Mon Oct 26 10:37:03 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: 89c849ba5013e45e8fb688b138f33c2ec6083dc5
Source-Link: googleapis/synthtool@89c849b
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-game-servers).
sofisl pushed a commit that referenced this issue Nov 16, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^9.0.0` -> `^10.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/9.0.11/10.0.0) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/compatibility-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fsinon/10.0.0/confidence-slim/9.0.11)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-recaptcha-enterprise).
sofisl pushed a commit that referenced this issue Nov 18, 2022
sofisl pushed a commit that referenced this issue Jan 17, 2023
sofisl pushed a commit that referenced this issue Jan 26, 2023
…v1 index_endpoint.proto chore: sort imports (#261)

* feat: add dedicated_resources to DeployedIndex message in aiplatform v1 index_endpoint.proto chore: sort imports

PiperOrigin-RevId: 425394497

Source-Link: googleapis/googleapis@bd97e46

Source-Link: googleapis/googleapis-gen@13eed11
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTNlZWQxMTA1MWUxY2Y5ZjlhYjQzZDE3NGYyM2QzNWZmYjMyOTQxYyJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

7 participants