Error: timeout of 10000ms exceeded

Hello!

We have a problem with Moralis API. We make the 3 consecutive requests like this https://deep-index.moralis.io/api/v2/0xf2Cc405AE6B9875E891c5191b46B88aAEb852fA6/function?chain=0x38&function_name=getLatestPrice

every 5 seconds. And every few minute we get the timeout errors (timeout of 10000ms exceeded) on every request, then it is works again.

Please, help us with this problem.

Thank you!

Params:

{
  inputs: [],
  name: 'getLatestPrice',
  outputs: [
    {
      internalType: 'uint256',
      name: '',
      type: 'uint256',
    },
  ],
  stateMutability: 'view',
  type: 'function',
}

Hi @disko23

Can you also share the contract address which you used for testing on the other chains?
So far it did not throw any error on bsc chain, when I tried to run this in a loop.

Hi!

Eth:
https://deep-index.moralis.io/api/v2/0x8487921DEa34a3B6107a80755c41E35cA2869F09/function?chain=0x1&function_name=getLatestPrice

Polygon:
https://deep-index.moralis.io/api/v2/0x8487921DEa34a3B6107a80755c41E35cA2869F09/function?chain=0x89&function_name=getLatestPrice

1 Like

Sometimes we have another error on the same requests (instead of timeout error)

Failed to fetch Moralis API, status: 400, statusText: Bad Request, body: {"message":"Invalid JSON RPC response: {}"}

what are you using to make those requests to web3api? can you change that timeout value of 10 seconds?

you can also lower the timeout value to 2-3 seconds and retry in case of timeout

this looks like an internal error from our side from when we try to make a RPC request to the node

In any case thank you for your answers!

2 Likes

Thank you for your reply! Can we, for our part, do something about this error?

you can not do too much on your side other than retrying the api call when you get that error