FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

crypto: fix wrong error message by benbucksch · Pull Request #33482 · nodejs/node · GitHub

/ node Public

crypto: fix wrong error message - #33482

Closed
benbucksch wants to merge 5 commits into
nodejs:masterfrom
benbucksch:crypto-error
Closed

crypto: fix wrong error message#33482
benbucksch wants to merge 5 commits into
nodejs:masterfrom
benbucksch:crypto-error

Conversation

benbucksch commented May 20, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

When calling crypto.sign(), if the key parameter object is
missing the key property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key" property
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

Fixes: #33480
This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

When calling `crypto.sign()`, if the `key` parameter object is
missing the `key` property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key property" argument
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

Fixes: #33480
This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.
nodejs-github-bot added the crypto Issues and PRs related to the crypto subsystem. label May 20, 2020

benbucksch commented May 20, 2020
edited
Loading

Copy link
Copy Markdown
Contributor Author

(removed comment regarding failed test)

Comment thread lib/internal/crypto/keys.js Outdated

himself65 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

and unit tests need an update too

Copy link
Copy Markdown
Contributor Author

and unit tests need an update too

I'm on it.

Copy link
Copy Markdown
Contributor Author

Review change done. Tests fixed.

benbucksch commented May 20, 2020
edited
Loading

Copy link
Copy Markdown
Contributor Author

Ready to merge.

Seems like the tests pass.

BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Great work and good catch!

Copy link
Copy Markdown
Collaborator

BridgeAR added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label May 23, 2020

nodejs-github-bot commented May 23, 2020
edited by BridgeAR
Loading

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

@nodejs/crypto this could use another review.

ryzokuken left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM. Thanks for the ping, @BridgeAR.

BridgeAR pushed a commit to BridgeAR/node that referenced this pull request May 25, 2020
When calling `crypto.sign()`, if the `key` parameter object is
missing the `key` property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key property" argument
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.

PR-URL: nodejs#33482
Fixes: nodejs#33480
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>

Copy link
Copy Markdown
Member

Landed in 2f00ca4

BridgeAR closed this May 25, 2020

Copy link
Copy Markdown
Contributor Author

Thanks! :)

benbucksch deleted the crypto-error branch May 26, 2020 00:34
codebytere pushed a commit that referenced this pull request Jun 18, 2020
When calling `crypto.sign()`, if the `key` parameter object is
missing the `key` property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key property" argument
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.

PR-URL: #33482
Fixes: #33480
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
codebytere mentioned this pull request Jun 28, 2020
codebytere pushed a commit that referenced this pull request Jun 30, 2020
When calling `crypto.sign()`, if the `key` parameter object is
missing the `key` property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key property" argument
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.

PR-URL: #33482
Fixes: #33480
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
codebytere pushed a commit that referenced this pull request Jul 8, 2020
When calling `crypto.sign()`, if the `key` parameter object is
missing the `key` property, the error message is wrong.

Before the fix:
TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of
type string or an instance of Buffer, TypedArray, DataView, or
KeyObject. Received an instance of Object

Expected:
TypeError [ERR_INVALID_ARG_TYPE]: The "key.key property" argument
must be of type string or an instance of Buffer, TypedArray,
DataView, or KeyObject. Received undefined

This seems like a copy&paste bug. Somebody copied from the end of
the function, where this is correct, to here, where it's wrong.

PR-URL: #33482
Fixes: #33480
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
codebytere mentioned this pull request Jul 13, 2020

eezhi commented Oct 15, 2020

Copy link
Copy Markdown

I get this error when i run 'knex migrate:latest" and I have no idea how to fix it. Been on it for days

benbucksch commented Oct 15, 2020
edited
Loading

Copy link
Copy Markdown
Contributor Author

@eezhi : If you get this error message, you (or whoever wrote the code you run) are using the API wrong, specifically the type of one of your parameters is wrong. The API here is very confusing, because it accepts several different types for backward compat, so please read the docs very very carefully and slowly. I had severe trouble to understand it as well.

If you still can't figure it out, post somewhere on a developer help forum. This ticket here is not the right place for getting help about your problem.

eezhi commented Oct 16, 2020

Copy link
Copy Markdown

@eezhi : If you get this error message, you (or whoever wrote the code you run) are using the API wrong, specifically the type of one of your parameters is wrong. The API here is very confusing, because it accepts several different types for backward compat, so please read the docs very very carefully and slowly. I had severe trouble to understand it as well.

If you still can't figure it out, post somewhere on a developer help forum. This ticket here is not the right place for getting help about your problem.

Alright thanks

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. crypto Issues and PRs related to the crypto subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong and misleading error message from crypto.sign(..., key)

6 participants


Back | FazBrowse Home | New Git URL