Replies: 20 comments 3 replies
-
Check your url, make sure the path is correct, the api key is correct. |
Beta Was this translation helpful? Give feedback.
-
What environment are you in? |
Beta Was this translation helpful? Give feedback.
-
Everything is correct, it does not happen all the time.
This is running in Node. |
Beta Was this translation helpful? Give feedback.
-
Would this happen if there was a provider rate limit? |
Beta Was this translation helpful? Give feedback.
-
I had this too. It's a problem with some internet providers (not node providers!) Check your code on some remote server. I've switched to WebSocketProvider and this problem is gone now. |
Beta Was this translation helpful? Give feedback.
-
It's running on an AWS instance. Did you have a similar issue? I don't think I can use websocket provider because I am using other chains and L2s which don't all have websocket providers. |
Beta Was this translation helpful? Give feedback.
-
I had similar issue on my home machine but it was ok when I run the same code on Google Cloud (and then I switched to websockets). It was presumably some issue with depleting some kind of network resources (like max network connections or something alike). But of course the nature of your issue may be completely different. |
Beta Was this translation helpful? Give feedback.
-
Is there any way to know what function it's coming from? I'd like to be able to catch the error at least. |
Beta Was this translation helpful? Give feedback.
-
Are you using one provider to connect or making new instances frequently? |
Beta Was this translation helpful? Give feedback.
-
I thought you were onto something but I just checked the code, and we are reusing the providers. Any other reason why this would be happening? What method is this coming from? |
Beta Was this translation helpful? Give feedback.
-
We are doing something like this every 30 seconds: await Promise.all(
Object.entries(hydrated).map(async ([chainId, provider]) => {
// base asset
const balance = await provider.getBalance(signerAddress);
const chainInfo: ChainInfo = await getChainInfo(Number(chainId));
const baseAssetName: string = getAssetName(Number(chainId), AddressZero);
this.set(
{ chainName: chainInfo?.name ?? chainId, chainId, assetName: baseAssetName, assetId: AddressZero },
parseFloat(formatEther(balance)),
);
// tokens
await Promise.all(
Object.entries(rebalancedTokens[chainId] ?? {}).map(async ([assetId, config]) => {
const balance = await config.contract.balanceOf(signerAddress);
const assetName: string = getAssetName(Number(chainId), assetId);
const toSet = await parseBalanceToNumber(balance, chainId, assetId);
this.set({ chainName: chainInfo?.name ?? chainId, chainId, assetName, assetId }, toSet);
}),
);
}),
); Where |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what function is causing it. My assumption is it would be one of Just something that may narrow the problem: Does the same code run asynchronously work? Could be something to do with many synchronous calls to the provider. |
Beta Was this translation helpful? Give feedback.
-
@conorbros how do you mean run asynchronously? We are running this asynchronously, parallelized over the providers. Can you provide another example of running it asynchronously? |
Beta Was this translation helpful? Give feedback.
-
Aren't you then parallelizing over all the tokens on each provider? |
Beta Was this translation helpful? Give feedback.
-
Yes, you're correct, the tokens are being parallelized. We will try to make this synchronous. |
Beta Was this translation helpful? Give feedback.
-
Okay, hopefully that should narrow the problem. You might also find its a specific provider causing the error. |
Beta Was this translation helpful? Give feedback.
-
This is often a link problem with the backend node. As other have pointed out this could be a URL problem (since a bad URL cannot be connected to ;)), but can also occur in testing when an attempt is made to connect to a node that is not up and running yet. If there are proxies in the way, problems can also occur if they are not properly forwarding proper error codes or in the case of CORS the Basically, this is a hard to debug issue, because it is usually not at the application level. My first suggestion to start debugging, when possible (e.g. on a host), is to use I hope that helps. And if you find the problem and solution, post it here too, so others can benefit from your anguish. :) |
Beta Was this translation helpful? Give feedback.
-
(moving to discussions) |
Beta Was this translation helpful? Give feedback.
-
Hi. I am getting the same error but against the local private chain (ganache). I can see that the ganache log has received |
Beta Was this translation helpful? Give feedback.
-
I'm seeing this issue when running a ganache rpc locally. When creating a provider, I was specifying the following. new ethers.providers.JsonRpcProvider("http://localhost:8545") When I changed the url from new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545") |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We have a system running in production which is generating frequent error logs with this message:
Any idea what could be causing it? I'm looking at my providers and I don't seem to be hitting rate limits. How can I catch this error or find out where in my code it's coming from?
Beta Was this translation helpful? Give feedback.
All reactions