Fixing crypto-js issues in Postman

I have a postman collection with a pre-request and post-request script. It had worked up until some time around the beginning of this year.

We started getting the Cannot read properties of undefined (reading 'sigBytes')" error after doing a regular update to postman.

I have found little to no help in postman forums for this. We are using crypto-js and have it required in the script…“const cryptojs = require('crypto-js');”.

We were hoping it may resolve itself through the next couple of updates but that has passed and the error is still there.

Hey @docking-module-geo33 :waving_hand:t2:

Welcome to the Postman Community :postman:

Could you share the full script that’s being used here?

Is ‘sigBytes’ something that’s coming from a previous response or another variable?

Hey @docking-module-geo33!

Just to help narrow things down, are you using any of the HMAC functions from crypto-js? If so, could you double-check that the second argument (“key”) being passed to it is not undefined?

With key undefined:

With the correct key:

1 Like

Thank you for the correct HmacSHA256 syntax. That led me to a solution which is working

1 Like