[SOLVED] Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'account') at login2

I seem to be experiencing a problem. When I run the following function whilst user is logged in, I keep getting the above error. The odd thing is that I am able to display the users’ address through alert(user.get('ethAddress')), hence it is not an authentication issue that I am having.
However, when I include const balance = await Moralis.Web3API.account.getNativeBalance() in the function I keep getting 'TypeError: Cannot read properties of undefined (reading ‘account’) ’

async function abc() {
        let user = Moralis.User.current();
        alert(user.get('ethAddress'))
        const  balance = await Moralis.Web3API.account.getNativeBalance();
        
        alert(balance.balance)

Some help would be appreciated

do you use latest version of Moralis SDK?

How would I update the SDK

you have somewhere in your html a line that looks similar to this one:

    <script src="https://unpkg.com/moralis/dist/moralis.js"></script>

forgot to include that line…Thank you very much