Error: Could not fetch keys with moralisSecret

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.

Can you add more logging?

You could get that error if you try too many times as there is a rate limit

On my part - no. That’s all I get. If you say how to expand the logs - on your part, I will do everything you need.

I also thought about this, but I didn’t find anywhere - how to check and where to see.
I can send you PM moralisSecret to see what the problem is.

Thanks a lot.

I mean, you can add some logging before calling Moralis.start, to see how many times it is called, for example, or in that init function

you get that error every time?

Got u. Let me try. And I came back to u.

Thanks.

Add this:

Logger.log(addDebugData(this.sFileName, 'MoralisApi -> Moralis.start -> start'));|

await Moralis.start({moralisSecret});

Logger.log(addDebugData(this.sFileName, 'MoralisApi -> Moralis.start -> end'));|

and the in log file:

02-08-2022 15:04:57 [MoralisApi.js][MoralisApi.init][54]: MoralisApi -> Moralis.start -> start
02-08-2022 15:04:58 [MoralisApi.js][MoralisApi.init][59]: MoralisApi -> Moralis.start -> end

So it run once.

What next?

what do you mean with old server and new server? that moralisSecret is per account and not per user

you said that it was working with an old server

what do you mean with old server and new server? that moralisSecret is per account and not per user

you said that it was working with an old server

This code was running on old server (VPS) and a few days ago we got a new server (VPS). They simply transferred the code, and these mistakes began to appear.

Thanks.

This code was running on old server (VPS) and a few days ago we got a new server (VPS). Then simply transferred the code, and these mistakes began to appear.

Thanks.

ok, so nothing else changed, it is just that now it doesn’t work any more on another VPS server

if you run that code from your local computer it works?

I never run it local and I have no any development on local PC.

I tested now with a script like this in JS:

x = async () => {
    const  Moralis = require('moralis/node')
    console.log(Moralis.CoreManager.get("VERSION"))
    await Moralis.start({ moralisSecret: "4324324" });

    x = await Moralis.Web3API.account.getNFTs({address: '34234234', chain: 'eth', limit: 5})
    console.log(x)
    }

x();

and it worked without issues

1 Like

What u mean? Maybe this error about it in my case? Due to the fact that we moved to a new VPS, we have a hard processing speed, and I admit that if your service have a limit on a number of requests per second / minute / hour, we could open up. Can then such an error be given to this case then?

How and where I can view statistics by requests of moralisSecret?

Thanks.

If you have a script that runs continuously then it could cause that error. You could try with a simple script from another IP to get it closer to the issue.

We have already found out it run once.

Why do you think that this will help me?

And, you never answered a question about limits.

Thanks.

I don’t know how to check the limits. The rate limit is per IP.

So there is no info about it in control panel? Very strange, this is an important indicator.