Web3Api not initialized

image
Does anyone know what this error could be about? I am doing a getTransaction() method and this error poped up.
I am runing ganache and the frpc as well.
This is the code:

Moralis.initialize("j79GIU8fZ4bOxug8XTaOBJgscgFGr3uohMjiDMOh");
Moralis.serverURL = 'https://3ok3tixamqj0.moralis.io:2053/server'
const TOKEN_CONTRACT_ADDRESS = "0x9D0F71D883cDa8bd086709330De6b6741cBbE828";
const MARKETPLACE_CONTRACT_ADDRESS = "0x431A8e64b5ad32D54151094cDCD76c55fdb91007";

init = async () => {

    window.web3 = await Moralis.Web3.enable();
    window.tokenContract = new web3.eth.Contract(tokenContractAbi, TOKEN_CONTRACT_ADDRESS);
    window.marketplaceContract = new web3.eth.Contract(marketplaceContractAbi, MARKETPLACE_CONTRACT_ADDRESS);
}
 
login = async () => {
    try {
        await Moralis.Web3.authenticate();
        initUser();
    } catch (error) {
        alert(error)
    }
}

logout = async () => {
    await Moralis.User.logOut();
    // hideElement(userInfo);

    initUser();
}



initTemplate = (id) => {
 const template = document.getElementById(id);
 template.id = "";
 template.parentNode.removeChild(template);
 return template;
}


login = async () => {
    try {
        await Moralis.Web3.authenticate();
        initUser();
    } catch (error) {
        alert(error)
    }
}

logout = async () => {
    await Moralis.User.logOut();
    // hideElement(userInfo);

    initUser();
}




async function getTransactions(){

const options = { chain: "ganache", address: "0x5C912Bd3D06c60Cdd7EBe11b14C0A22caeE43E77", order: "desc", from_block: "0"};
const transactions = await Moralis.Web3API.account.getTransactions(options);
console.log(transactions);
loadItems = async () => {
    const trans = transactions;
    user = await Moralis.User.current();
    trans.forEach(trans => {
        if (user){
            if (user.attributes.accounts.includes(trans.ownerOf)){
                const userItemListing = document.getElementById(`user-trans-${trans.tokenObjectId}`);
                if (userItemListing) userItemListing.parentNode.removeChild(userItemListing);
                getAndRenderItemData(trans, HistoryT);
                return;
            }
        }
        getAndRenderItemData(trans, HistoryT);
    });
}
loadItems();
}

getTransactions();

HistoryT = (transaction) => {
    const alltransaction = historyTemplate.cloneNode(true);
    
        alltransaction.getElementsByTagName("h5")[0].innerText = "To address: " + transaction.to_address;
        alltransaction.getElementsByTagName("h6")[0].innerText = "From address: " + transaction.from_address;
        alltransaction.getElementsByTagName("p")[0].innerText = "Time: " + transaction.block_timestamp;
        alltransaction.getElementsByTagName("h8")[0].innerText = "Total Price: 0." + transaction.gas;        

    alltransaction.id = `transaction-${transaction.uid}`;
    transactionTemplate.appendChild(alltransaction);
}


getAndRenderItemData = (transaction, renderFunction) => {
    
        transaction.to_address = transaction.to_address;
        transaction.from_address = transaction.from_address;
        
        
        renderFunction(transaction);
    }



//navbar extra
const navConnectWallet = document.getElementById("navConnectWallet");
const navMyItems = document.getElementById("navMyItems");
const navCreate = document.getElementById("navCreate");
const navProfile = document.getElementById("navProfile");
const navLogout = document.getElementById("navLogout");

const historyTemplate = initTemplate("historyTemplate");
const transactionTemplate = document.getElementById("transactionTemplate");


init();

this is an old syntax, now you have to use Moralis.start instead of that.
https://docs.moralis.io/moralis-server/getting-started/connect-the-sdk#main.js-2

ok many thanks!!!