This code is still running in v1 as a Cloud Function and totalNum is always NULL (for Polygon as well as Ethereum).
There have been bugs related to that API in the past, which got fixed quickly. Hope this time as well
Thanks for your help in advance !
const optionsPolygon2 = { chain: "polygon", direction: "to", address: userAddress };
let transfersNFTPolygon = await Moralis.Web3API.account.getNFTTransfers(optionsPolygon2);
totalNum = transfersNFTPolygon.total;