TypeError: Cannot read properties of undefined (reading 'utils')

Hello Guys

I’m trying to use Moralis in a project, but get this error:

TypeError: Cannot read properties of undefined (reading ‘utils’)
at recentlyPutForSale (discover.js:426:31)

when I replaced in function

let priceInEth = web3.utils.fromWei(price, 'ether');


let priceInEth = 3;

it`s work,

I have tried this code,

let priceInEth = web3.utils.fromWei('1', 'ether');

but this does not work
Does anybody know how to fix this issue I’m having ?

you can use Moralis Units: https://docs.moralis.io/moralis-server/tools/moralis-units

1 Like

Thanks cryptokid, I am able to get it working through Moralis Units

Hey @Avatar, not very sure where did you get the web3 there, but if you’re getting the latest version might be cause by our breaking change to move from web3js to etherjs Moralis JS SDK v1.0 (migration to Ethers.js)

This is not a fix as it’s already solved with Moralis.Units, but a reminder of the breaking change :raised_hands: so you’re aware of the update on our SDK