I have a function to get the price of a token every 5s.
const options = {
address: âxxxxâ,
chain: âbscâ,
exchange: âPancakeSwapv2â,
};
const tokenPrice = await Moralis.Web3API.token.getTokenPrice(options);
Recently itâs always error on the console log, even I still can get the price sometimes.
can you share server subdomain/url?
I see this in logs:
{"functionName":"getTokenPrice","error":{"message":"Too many requests to Web3API from this particular client, the clients needs to wait before sending more requests. This can be adjusted using Moralis.settings.setAPIRateLimit. Read More: https://docs.moralis.io/moralis-server/web3-sdk/rate-limit.","code":141}
ah i see. I open many tabs and this function is running on each tab so thatâs why itâs limited.
How can i increase the rate limit? write this one in the cloud function, right?
Moralis.settings.setAPIRateLimit({
anonymous:100, authenticated:200, windowMs:60000
})
yes, adding something like that in cloud code
1 Like
Hi @cryptokid,
I have a same issue. I cannot access web3 api with moralis sdk. What can i do for solve this problem?
Thanks.
usually you can get that error when the server has some issues, can you try again?
if still not working, try to restart/update the server
1 Like