[SOLVED] getTokenBalances API call in cloud functions

Hi,

I was trying to get token balance in one of the cloud functions. But Iā€™m getting error when calling this function.

Method (in cloud function):

Moralis.Cloud.define("getTokens", async (request) => {
    const result = await Moralis.Web3API.account.getTokenBalances({chain: "bsc", token_address: "0xaf3889ba617ac973b35851..."});
    return result;
});

Error in console:

Uncaught (in promise) Error: required param address not provided

Can someone please suggest where Iā€™m doing wrong.

did you try with address instead of token_address?

Seems my bad.
I was using similar functionality in js, and this call was happening after metamask login, hence it worked there.
Thanks for quick reply!