I'm getting ECONNRESET error for web3api calls sometimes

Hi, I’m using the web3 api to get addresses NFT. (/nft)

I’m going through a large list and it gets a timeout each time after a while…
I need the ability to do a lot of /nft requests daily .

How many nfts has that address?
Or it doesn’t matter and you get that error randomly?

Yes I’m getting that error randomly

Ok, then maybe you can try again with the same parameters when you get that error.

Do you mean to add some functionality of retry?
But I dont want to wait 2 minutes because apparently it happens a lot … I need to do that call maybe 1 million times a day… it will waste a lot of time waiting for 2 minutes each random one

you mean that the timeout is of 2 minutes?
you can use 2 threads for example, so that you don’t wait 2 minutes, or maybe set a smaller timeout for the request in case that it waits 2 minutes

does the API Rate limit affect this? I have the pro plan and as I understand I can request a higher Rate Limit than 2/sec or something … this is the core of the APP functionality and we need ~ 1M calls daily

if you need a higher plan, then you can send an email to [email protected], we can offer plans with a higher number of requests for web3api

about the limit, if depends on what type of request you make

in particular (from https://deep-index.moralis.io/api/v2/info/endpointWeights)
/{address}/nft has a cost of 5:

{
    "endpoint": "getNFTs",
    "path": "/{address}/nft",
    "price": 5,
    "rateLimitCost": 5
  }

meaning that you could make up to 12 requests per second with a pro plan to that /{address}/nft endpoint

@salvatort2
Another way, could be to store the request in the DB and make calls from DB, so that you don’t have to make a million calls to APIs.

so meanwhile to make some functionality that doesn’t allow timeout more than 1 second for example?

That doesn’t help me… I need to fetch the NFT owned by around 300k address daily… to see the changes they’ve done in their purchases - that is the whole idea of our app

It depends on what code you use. You can make REST http requests to the api that you can control how you call them.

is there an option using the sdk?

I don’t know of an option to set timeout from the sdk.

It is not complicated to use REST API, you can test it and see Curl example directly in this interface:

I have tried using a connection timeout and it almost always fails with 1-2 seconds timeout when there is a cursor in the request …

try with 10-20 seconds timeout, some requests may not be resolved in 1 second

but if I need to make 1M requests like this daily I wont be able with this timeout… anyway to split the calls or something?

try again now, it may work faster (we just made an update to allow only 100 max limit per page), only some calls could be slower, not all of them

you can always use threads or different processes to make concurrent requests