Hi there.
Can u please help me with my case and fix the error:
01-08-2022 21:35:06 [MoralisApi.js][MoralisApi.init][76]: Error start Moralis server on moralis.io:
Error: Could not fetch keys with moralisSecret
01-08-2022 21:35:06 [MoralisApi.js][MoralisApi.init][76]: Error start Moralis server on moralis.io:
Error: Could not fetch keys with moralisSecret
01-08-2022 21:35:06 [MoralisApi.js][MoralisApi.getTokenData][136]: Error get pair address from moralis.io #1:
Error: Web3Api not initialized, run Moralis.start() first
I have these errors on a new server (on old server there is no such errors).
So the code is like this:
async init()
{
const moralisSecret = oConfig.services.moralis.moralisSecret;
this.arMoralisExchanges = oConfig.services.moralis.arExchanges;
this.arMoralisChains = oConfig.services.moralis.arChains;
let sErrorMsg = null;
try
{
await Moralis.start({moralisSecret});
this.eth = Moralis.web3Library;
this.isMoralisStarted = true;
}
catch(sError)
{
if(config.logger.enabled)
{
sErrorMsg = `Error start Moralis server on moralis.io:`;
Logger.error(addDebugData(this.sFileName, sErrorMsg + '\r\n' + sError));
sendTelegramMsg(addDebugData(this.sFileName, sErrorMsg + '\r\n' + sError));
}
}
}
async getTokenData(sChain, sTokenContractAddress)
{
if(empty(sChain) || empty(sTokenContractAddress))
return false;
if(!this.isMoralisStarted)
await this.init();
...
}
The init()
run from another file.
Thanks a lot.