[SOLVED] contract.getPastEvents() error

events = await contract.getPastEvents("Withdraw", {
        filter: { _from: address },
        toBlock: fromBlock + 4999,

I try to get history transactions but sometimes work sometime error. Is it about network issue?
What is the best way to resolve this?

I don’t know exactly, on what chain are you doing that?
can you lower the number of blocks?

you could also try to sync all the events in your Moralis server db if there are not 100k+ events

thanks. i changed 4999 to 999 and it’s working. just slow to retrieve all data