-
Notifications
You must be signed in to change notification settings - Fork 30k
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
crypto: fix wrong error message #33482
Conversation
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.
(removed comment regarding failed test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and unit tests need an update too
I'm on it. |
Review change done. Tests fixed. |
Ready to merge. Seems like the tests pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Great work and good catch!
@nodejs/crypto this could use another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the ping, @BridgeAR.
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 <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
Landed in 2f00ca4 |
Thanks! :) |
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 <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
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 <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
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 <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
I get this error when i run 'knex migrate:latest" and I have no idea how to fix it. Been on it for days |
@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 |
When calling
crypto.sign()
, if thekey
parameter object ismissing 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), orvcbuild test
(Windows) passes