Disable batching? ("Too many eth_getLogs methods in the batch") #4130
Replies: 6 comments 9 replies
-
The // Create your network
const network = Network.from(137)
// Return a Provider with batching disabled and with static network optimizations enabled
function getProvider(url) {
return new ethers.JsonRpcProvider(url, null, { batchMaxSize: 1, staticNetwork: network });
}
const backends = [
{
provider: getProvider('https://rpc.ankr.com/polygon'),
priority: 2,
weight: 2,
stallTimeout: 2500,
},
{
provider: getProvider('https://polygon-rpc.com'),
priority: 3,
weight: 1,
},
{
provider: getProvider('https://rpc-mainnet.maticvigil.com'),
priority: 3,
weight: 1,
},
]; That will provide you with the best performing FallbackProvider for your purposes, I believe. |
Beta Was this translation helpful? Give feedback.
-
Thanks! However, even with the above JsonRpcProvider settings, I'm still getting this error. It's causing a full app crash, which is also kind of an unexpected behavior. Would there be a difference with setting ––
|
Beta Was this translation helpful? Give feedback.
-
![]() |
Beta Was this translation helpful? Give feedback.
-
It is weird it is asking for the chain ID at all, little line within the same batch. I can try connecting to those endpoints and see what I get with that getLogs request. |
Beta Was this translation helpful? Give feedback.
-
Here's another request made with Ethers v6.5.1. Not only are there dozens of chainId requests, and 60 requests total, but there are tons of duplicate getLogs requests as well. This results in the error
|
Beta Was this translation helpful? Give feedback.
-
I think we have 5 issues to resolve here. I'm dedicating today + tomorrow to try to hammer on these.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ethers Version
6.4.2
Search Terms
No response
Describe the Problem
Ethers crashes the program during initial connection (
contract.on
listener assignment), with the following error.Using a set of polling JsonRpcProviders within a FallbackProvider.
Is there a way to limit the requests, so we don't hit this error?
Code Snippet
Contract ABI
No response
Errors
Environment
No response
Environment (Other)
No response
Beta Was this translation helpful? Give feedback.
All reactions