-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cannot read property 'sigBytes' of undefined #85
Comments
i have the same error |
any luck with this ? i have the same behavior |
same issue |
same issue as well |
me too |
The parameter is wrong. It should be two, passed one |
I also had the same error. |
TypeError: Cannot read property 'sigBytes' of null |
Same issue. It works in one environment and doesn't on other..any luck ? |
took me a while to figure this out. HmacSHA256 is not receiving all parameters, or receives "undefined". |
I am getting this same issue and no one can fix the problem.
anyone has any idea how to fix it ?? |
I had the same issue - big thanks to @vghetau for pointing me in the right direction! This error means that one of the hmac crypto functions is receiving an undefined value in the "key" parameter (which is the second one). I found it by doing some logging to see which was undefined: console.log(signature); // prints the expected signature
console.log(secret); // prints "undefined"!
signature = CryptoJS.HmacSHA256(signature, secret); From there it was straightforward to trace that variable back and see that it was being assigned incorrectly. If you're getting this error from some other code that's ending up in a call to CryptoJS, you might have forgotten to assign some other variable it was passing in? The line throwing the exception might be this one, if you're curious. Although the line number doesn't match the one in @jayzhou3's answer... |
Maybe if a guard clause was added to check for this and return a less cryptic error if the key is null? |
To me they should simply implement the latest version of CryptoJS |
good reply |
Does anyone have the solution already for this issue? Using the method PBKDF2 is getting the same problem returning as undefined! |
I had this same problem and it was because I forgot to select the Postman environment from the dropdown in the top right corner of the app. 🤦 Reference |
Please check is your signature is valid for CryptoJS , If in case the signature is undefined then you will get the above error. |
ERROR TypeError: undefined is not an object (evaluating '_reactNativeCryptoJs.default.algo.HMAC.create') Any help for HMAC REACT NATIVE var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, "Secret Passphrase"); var hash = hmac.finalize(); console.log("messaging part ----------" + hash); // var hash = CryptoJS.HmacSHA256("Message", "Secret Passphrase"); ERROR TypeError: undefined is not an object (evaluating '_reactNativeCryptoJs.default.algo.HMAC.create') |
This is exactly my problem, thans a lot |
CryptoJS.HmacSHA1: |
On encryption.js Just replace line from var hashKey = CryptoJS.PBKDF2 to var hashKey = CryptoJS.HmacSHA1 |
same issue const base64 = btoa(CryptoJS.HmacSHA1("/v1/request/callback/" + query + CryptoJS.MD5(query)), secret); |
So how did you fix it? I'm afraid that's my problem either. |
My error was happening on the following code CryptoJS.HmacSHA256(rawSignature, secret); my rawSignature was "undefined:123456" and my secret was "undefined", fixing these undefined fixed my problem. |
in my case CryptoJS.HmacSHA256(arg1, arg2) the value of arg1 or arg2 passed in the function was undefined |
Cannot read property 'sigBytes' of undefined
TypeError: Cannot read property 'sigBytes' of undefined
at Object.init (/Volumes/T3/node_web/myapp/node_modules/crypto-js/hmac.js:53:21)
at /Volumes/T3/node_web/myapp/node_modules/crypto-js/core.js:744:25
at /Volumes/T3/node_web/myapp/routes/index.js:38:16
at Layer.handle [as handle_request] (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/layer.js:95:5)
at next (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/layer.js:95:5)
at /Volumes/T3/node_web/myapp/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/index.js:330:12)
at next (/Volumes/T3/node_web/myapp/node_modules/express/lib/router/index.js:271:10)
The text was updated successfully, but these errors were encountered: