I've noticed that relying on one provider API can be problematic at times of heavy server load. I would like to use EthersJS to choose either Infura or Alchemy depending on which network is available at the time. I've tried using ethers.providers.FallbackProvider as follows:

const provider = new providers.FallbackProvider([
  new providers.AlchemyProvider(NETWORK_NAME, ALCHEMY_KEY),
  new providers.InfuraProvider(NETWORK_NAME, INFURA_KEY),

But I've recently discovered that my app was failing to an internal Alchemy server error, even though Infura seemed to be available at the time.

1 Answer 1


As you said infura seems to work more often then Alchemy, there are multiple things that you can do.

  1. You can set the priority provider as infura.
  2. You can also set a stallTimeout, which will fallback to another provider in case of delay. But this will lead to a slower response time.
  3. You can also set the weight.

For reference ether docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.