Hey @snstarosciak
Please always provide your server subdomain so we will be able to check your logs on our end
Hey @snstarosciak
Please always provide your server subdomain so we will be able to check your logs on our end
that seems like a old version of Moralis
you may also have an old version of Moralis Server because you donāt have a specific error message.
Thanks for the response. What version of Moralis should I be using then?
In terms of Moralis server, is that something I can update through the Moralis admin dashboard?
@Yomoo are you referring to https://t4uvhn89qbpj.usemoralis.com
?
you can update the server from admin dashboard, it looks like your server is version 0.0.281 and latest version now is 0.0.307
you should use latest Moralis SDK version
usually you can get latest version with <script src="https://npmcdn.com/moralis@latest/dist/moralis.js" ></script>
Ah okay thankyou for this, after upgrading I am now seeing that the 141 error is saying that the Rate limit is exceeded. So my theory was correct haha is this related to the server needing to be upgraded? Or do I need to artificially slow down the requests?
what is the exact error that you get?
depending on the message it can be two different cases: https://docs.moralis.io/misc/rate-limit#why-am-i-rate-limited
Ah this makes sense. The exact error Iām getting is this:
{"code":141,"error":"Rate limit exceeded."}
I saw you can setup rate limiting in the cloud code, but Iām not exactly sure where to do that. I saw this snippet:
Moralis.settings.setAPIRateLimit({
anonymous:10, authenticated:20, windowMs:60000
})
Is there an equivalent for the Front-end SDK?
that error look like the second case of error, how many requests did you make?
you have to put a modified version of that snippet in your cloud code, it should be enough to put it there, but that 10 means that are allowed only 10 requests in a minute for a user that is not authenticated.
Hmm yeah I mean Iām on the paid plan and Iām still getting this error, even after upgrading the server. I believe itās roughly 139 requests where Iām hitting rate limits. Even when I update the cloud code, itās still executing all those calls and Iām hitting the same rate limit issue hmmm. Just out of curiosity, what would be a safe API Rate limit for a free account? Maybe I can start there just to make sure thatās working at the very least.
those 139 requests, in what interval of time are you making them? in a second, in a minute?
and to what API endpoint are those requests?
The Request URL is https://t4uvhn89qbpj.usemoralis.com:2053/server/functions/getTokenIdMetadata
And actually I may have not updated the correct place with the rate limiting code. Is there some documentation to explains where exactly to place āCloud codeā? I assume itās not inside the āCloud Functionsā code but elsewhere, because it doesnāt seem to be rate limiting my calls at all. Itās 139 calls in less than a minute, for sure
I see this in logs:
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com web3 api fetch error: Rate limit exceeded. HTTPResponse {
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com status: 429,
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com headers: {
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com date: 'Fri, 17 Dec 2021 14:06:56 GMT',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'content-type': 'application/json; charset=utf-8',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'content-length': '34',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com connection: 'close',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-powered-by': 'Express',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'access-control-allow-origin': '*',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-remaining-ttl': '51',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-used': '283',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-limit': '5000',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-remaining-ttl': '5',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-used': '192',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-limit': '100',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-remaining': '51',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-remaining': '5',
in particular:
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-used': '192',
Dec 17 06:06:56 t4uvhn89qbpj.usemoralis.com 'x-rate-limit-throttle-limit': '100',
Hmmm yeah Iām not sure what to do here. I keep getting rate limited even though Iām on the paid plan and I normally shouldnāt be even getting close to the limit. Is there some kind of rate block thatās happening that is impossible to get around?
so 100 is the max there? I guess thereās no way around that is there
I think that you are making too many requests in a second, and it is a limit of requests per second
Well Iāve added a rate limiting function on the front-end website that only tries calling the API a max of 5 times per second and now Iām getting this error:
{"code":141,"error":"Too many requests, please try again later."}
What could I be doing wrong now? haha
now you are in the case of rate limit that you can resolve with that code added in cloud functions code
but add there bigger numbers and not only 10 and 20
I tried that and it didnāt seem to do anything. Itās really weird that Iām only doing 5 requests to that API endpoint per second and after like 50 calls, Iām getting that same error now. Am I being limited per minute now if itās more than 100 or so?
it looks like there is no cloud code on this server now