Request Failed or Timed out in Polygon

I’m using Infura api endpoints to fetch event_logs on the Polygon network.
To avoid Infura limitation (max 10,000 result by single query, Not exeed 10 seconds for query duration), I was trying to divide from/to blocknumber range with several sub ranges, other means:
from blocknumber: 0, to blocknumber: ‘latest’ =>
from blocknumber: 0, to blocknumber: 0 + 10000,
from blocknumber: 10000, to blocknumber: 20000,

from blocknumber: lastest - 10000, to blocknumber: ‘latest’

something like above, and send request in every ranges with for loop. Code is below:

const limit = 10000
const startBlockNumber = fromBlock ?? filter.fromBlock

for (let i = latestBlockNumber; i > startBlockNumber; i -= limit) {
  const eventLogs = await fetchEventLogs(
    i - limit > startBlockNumber ? i - limit + 1 : startBlockNumber + 1,

export const fetchEventLogs = async (
  contract: Contract,
  eventFilter: ethers.EventFilter,
  fromBlock: number,
  toBlock: number
) => {
  const event = await contract.queryFilter(eventFilter, fromBlock, toBlock)
  return event

In this case, some ranges worked, and other case got timeout error. Mumbai testnet worked fine, and after switch to Polygon, got timeout error. ether.js used instead of web3.js in our project.

I know fetching event logs with this way is not so good as performance, but right now it’s Okay if is working for some times since we are planning to move to set server to store all event logs.
Is there any way to make working smoothly with infura api endpoints in polygon?
Maybe ethereum mainnet will working fine, only not possible in polygon

Hi @Cluster_Lee and welcome to our Infura community.

Please note that we are experiencing some degraded performance on our Polygon Mainnet. Once the issue is fixed I will let you know. In the meantime you can check the status here →

Hi, I’m noticing the same issue even though the Infura status page reports the issue as resolved.