Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(node:73511) UnhandledPromiseRejectionWarning: Error: failed to meet quorum (method="call", params={"transaction":.. #1067

Closed
zhengger opened this issue Sep 25, 2020 · 7 comments
Labels
discussion Questions, feedback and general information.

Comments

@zhengger
Copy link

zhengger commented Sep 25, 2020

I found a very similar issue like mine. But I cannot find the answer. So I posted a new issue here. Thanks for your help!
##841 (comment)

Part of my code below where @uniswap/sdk used ethers.js with @ethersproject_providers@5.0.9 :

require("dotenv").config();
const Web3 = require("web3");
const {
  ChainId,
  Token,
  TokenAmount,
  WETH,
  Fetcher,
  Trade,
} = require("@uniswap/sdk");
const abis = require("./abis");
const Web3WsProvider = require("web3-providers-ws");
const options = {
  timeout: 30000, // ms
  headers: {
    authorization: "Basic username:password",
  },
  clientConfig: {
    maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
    maxReceivedMessageSize: 100000000, // bytes - default: 8MiB
    keepalive: true,
    keepaliveInterval: 60000, // ms
  },

  reconnect: {
    auto: true,
    delay: 5000, // ms
    maxAttempts: 5,
    onTimeout: false,
  },
};

const ws = new Web3WsProvider(
  "wss://mainnet.infura.io/ws/v3/" + process.env.INFURA_URL_0,
  options
);
const web3 = new Web3(ws);

const {address: admin} = web3.eth.accounts.wallet.add(process.env.PRIVATE_KEY);

const init = async () => {

  await web3.eth
    .subscribe("newBlockHeaders")
    .on("data", async (block) => {
      console.log(`New block received. Block # ${block.number}`);

      const dai = new Token(
        ChainId.MAINNET,
        "0x6B175474E89094C44Da98b954EedeAC495271d0F",
        18
      );
      const weth = WETH[dai.chainId];

      const daiWeth_Pair = await Fetcher.fetchPairData(dai, weth);

      const amountsEth = await Promise.all([
        kyber.methods
          .getExpectedRate(
            addresses.tokens.dai,
            "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            AMOUNT_DAI_WEI
          )
          .call(), //! bug possible
        daiWeth_Pair.getOutputAmount(new TokenAmount(dai, AMOUNT_DAI_WEI)),
      ]).catch(console.log);
  }).on("error", (error) => {
      console.log(error);
    });
};

init();

Some Error information:

image

Error1:

New block received. Block # 10929215
New block received. Block # 10929216
(node:73511) UnhandledPromiseRejectionWarning: Error: failed to meet quorum (method="call", params={"transaction":{"to":"0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11","data":"0x0902f1ac"},"blockTag":"latest"}, results=[{"weight":1,"start":1601002249658,"result":"0x0000000000000000000000000000000000000000008182938c6e045bed6d6efe00000000000000000000000000000000000000000000604b50e085a4069fac51000000000000000000000000000000000000000000000000000000005f6d5ad5"},{"weight":1,"start":1601002249658,"result":"0x00000000000000000000000000000000000000000081816a72defcb033330d3600000000000000000000000000000000000000000000604c65ac967fa3989342000000000000000000000000000000000000000000000000000000005f6d5b05"},{"weight":1,"start":1601002250409,"result":"0x00000000000000000000000000000000000000000081831f5143b902a9a8e50700000000000000000000000000000000000000000000604b1fdd41a7c07cdd37000000000000000000000000000000000000000000000000000000005f6d5b02"},{"weight":1,"start":1601002250410,"error":{"reason":"missing response","code":"SERVER_ERROR","requestBody":null,"requestMethod":"GET","serverError":{"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"},"url":"https://api.etherscan.io/api?module=proxy&action=eth_call&to=0xa478c2975ab1ea89e8196811f51a7b7ade33eb11&data=0x0902f1ac&apikey=9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB"}}], provider={"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":10929215,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":1601002249657,"providerConfigs":[{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":10929215,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":1601002249657,"connection":{"url":"https://mainnet.infura.io/v3/84842078b09946638c03157f83405213"},"_nextId":44,"apiKey":"84842078b09946638c03157f83405213","projectId":"84842078b09946638c03157f83405213","projectSecret":null,"_internalBlockNumber":{},"_fastBlockNumber":10929215,"_fastBlockNumberPromise":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":0,"baseUrl":"https://api.etherscan.io","apiKey":"9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB","_internalBlockNumber":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":10929215,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":1601002251606,"connection":{"url":"https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"},"_nextId":44,"apiKey":"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC","_internalBlockNumber":{},"_fastBlockNumber":10929215,"_fastBlockNumberPromise":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":10929213,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":1601002248720,"connection":{"url":"https://cloudflare-eth.com/"},"_nextId":44,"_internalBlockNumber":{},"fastBlockNumber":10929213,"fastBlockNumberPromise":{}},"weight":1,"stallTimeout":750,"priority":1}],"quorum":2,"highestBlockNumber":10929215,"internalBlockNumber":{},"fastBlockNumber":10929215,"fastBlockNumberPromise":{}}, code=SERVER_ERROR, version=providers/5.0.9)
at Logger.makeError (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:188:20)
at FallbackProvider. (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:676:54)
at step (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:46:23)
at Object.f [as next] (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:27:53)
at fulfilled (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:18:58)
(node:73511) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:73511) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error2:

(node:73511) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 35)
(node:73511) UnhandledPromiseRejectionWarning: Error: failed to meet quorum (method="getBlockNumber", params={}, results=[{"weight":1,"start":1601003217919,"error":{"reason":"timeout","code":"TIMEOUT","requestBody":"{"method":"eth_getBlockByNumber","params":["latest",false],"id":42,"jsonrpc":"2.0"}","requestMethod":"POST","timeout":120000,"url":"https://cloudflare-eth.com/"}},{"weight":1,"start":1601003217920,"error":{"reason":"timeout","code":"TIMEOUT","requestBody":"{"method":"eth_blockNumber","params":[],"id":42,"jsonrpc":"2.0"}","requestMethod":"POST","timeout":120000,"url":"https://mainnet.infura.io/v3/84842078b09946638c03157f83405213"}},{"weight":1,"start":1601003526002,"error":{"reason":"timeout","code":"TIMEOUT","requestBody":"{"method":"eth_blockNumber","params":[],"id":42,"jsonrpc":"2.0"}","requestMethod":"POST","timeout":120000,"url":"https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"}},{"weight":1,"start":1601003526002,"error":{"reason":"timeout","code":"TIMEOUT","requestBody":null,"requestMethod":"GET","timeout":120000,"url":"https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB"}}], provider={"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":0,"providerConfigs":[{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":0,"connection":{"url":"https://mainnet.infura.io/v3/84842078b09946638c03157f83405213"},"_nextId":43,"apiKey":"84842078b09946638c03157f83405213","projectId":"84842078b09946638c03157f83405213","projectSecret":null,"_internalBlockNumber":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":0,"baseUrl":"https://api.etherscan.io","apiKey":"9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB","_internalBlockNumber":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"_pollingInterval":4000,"_fastQueryDate":0,"connection":{"url":"https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"},"_nextId":43,"apiKey":"_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC","_internalBlockNumber":{}},"weight":1,"stallTimeout":750,"priority":1},{"provider":{"_isProvider":true,"_events":[],"_emitted":{"block":-2},"formatter":{"formats":{"transaction":{},"transactionRequest":{},"receiptLog":{},"receipt":{},"block":{},"blockWithTransactions":{},"filter":{},"filterLog":{}}},"anyNetwork":false,"_network":{"name":"homestead","chainId":1,"ensAddress":"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},"_maxInternalBlockNumber":-1024,"_lastBlockNumber":-2,"pollingInterval":4000,"fastQueryDate":0,"connection":{"url":"https://cloudflare-eth.com/"},"nextId":43,"internalBlockNumber":{}},"weight":1,"stallTimeout":750,"priority":1}],"quorum":2,"highestBlockNumber":-1,"internalBlockNumber":{}}, code=SERVER_ERROR, version=providers/5.0.9)
at Logger.makeError (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:188:20)
at FallbackProvider. (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:676:54)
at step (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:46:23)
at Object.f [as next] (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:27:53)
at fulfilled (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_providers@5.0.9@@ethersproject/providers/lib/fallback-provider.js:18:58)

Error3:

Exception has occurred: Error
Error: missing response (requestBody="{"method":"eth_call","params":[{"to":"0xa478c2975ab1ea89e8196811f51a7b7ade33eb11","data":"0x0902f1ac"},"latest"],"id":43,"jsonrpc":"2.0"}", requestMethod="POST", serverError={"errno":"ECONNRESET","code":"ECONNRESET","syscall":"read"}, url="https://eth-mainnet.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC", code=SERVER_ERROR, version=web/5.0.7)
at Logger.makeError (/Users/zheng/Security/bots/ArBot/node_modules/@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_logger@5.0.5@@ethersproject/logger/lib/index.js:188:20)
at /Users/zheng/Security/bots/ArBot/node_modules/@ethersproject_web@5.0.7@@ethersproject/web/lib/index.js:211:36
at step (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_web@5.0.7@@ethersproject/web/lib/index.js:33:23)
at Object.f [as throw] (/Users/zheng/Security/bots/ArBot/node_modules/@ethersproject_web@5.0.7@@ethersproject/web/lib/index.js:14:53)
at rejected (/Users/zheng/Security/bots/ArBot/node_modules/
@ethersproject_web@5.0.7@@ethersproject/web/lib/index.js:6:65)
at process._tickCallback (internal/process/next_tick.js:68:7)

@zemse
Copy link
Collaborator

zemse commented Sep 25, 2020

Just a quick parsing of these errors to help you debug it further:

Error 1: ECONNRESET while making a eth_call request to etherscan backend.

Error 2: TIMEOUT while requsting eth_blockNumber cloudfare backend.

Error 3: ECONNRESET while requesting eth_call alchemy backend.

You can read more about ECONNRESET. The backend might drop connection requests when they receive a lot of them. Also there is a possibility that your node js is trying to make a lot of connections requests but your operating system denied making any more of it.

TIMEOUT is also somewhat similar when your node js doesnt hear back from the node. It also happened with me when I was making huge amount of requests to a node. I used to get response for some of them but most of them were a TIMEOUT.

Maybe you can experiment with reducing the poling interval in your subscription.

@ricmoo
Copy link
Member

ricmoo commented Sep 26, 2020

I think it must be another part of your code base that is causing those errors. A quorum error is only caused by a FallbackProvider, but I don’t see you instantiating one, so maybe it’s embedded in one of your other libraries?

@ricmoo ricmoo added the discussion Questions, feedback and general information. label Sep 26, 2020
@zhengger
Copy link
Author

zhengger commented Sep 27, 2020

@zemse Thank you so much, Zemse!
I set the fetch interval at 15 s which is recommended by infura and I set a listener for new block. Below is my code, could you help me to check if the interval is okay or not.

  let ethPrice;
  const updateEthPrice = async () => {
    const results = await kyber.methods
      .getExpectedRate(
        "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        addresses.tokens.dai,
        1
      )
      .call(); //! bug possible
    ethPrice = web3.utils
      .toBN("1")
      .mul(web3.utils.toBN(results.expectedRate))
      .div(ONE_WEI);
  };
  await updateEthPrice();
  setInterval(updateEthPrice, 15000);

  await web3.eth
    .subscribe("newBlockHeaders")
    .on("data", async (block) => {
      console.log(`New block received. Block # ${block.number}`);

      // Get Execution Price of ETH/DAI on Uniswap
      const dai = new Token(
        ChainId.MAINNET,
        "0x6B175474E89094C44Da98b954EedeAC495271d0F",
        18
      );
      const weth = WETH[dai.chainId];

      const daiWeth_Pair = await Fetcher.fetchPairData(dai, weth);

      // const daiWeth_Pair = await Pair.fetchData(dai, weth); //! only for SDK2.

      const amountsEth = await Promise.all([
        kyber.methods
          .getExpectedRate(
            addresses.tokens.dai,
            "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            AMOUNT_DAI_WEI
          )
          .call(), //! bug possible
        daiWeth_Pair.getOutputAmount(new TokenAmount(dai, AMOUNT_DAI_WEI)),
      ]).catch(console.log);

      const ethFromKyber = AMOUNT_DAI_WEI.mul(
        web3.utils.toBN(amountsEth[0].expectedRate)
      ).div(ONE_WEI);

      const ethFromUniswap = web3.utils.toBN(amountsEth[1][0].raw.toString());

      const amountsDai = await Promise.all([
        kyber.methods
          .getExpectedRate(
            "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            addresses.tokens.dai,
            ethFromUniswap.toString()
          )
          .call(), //! bug possible
        daiWeth_Pair.getOutputAmount(
          new TokenAmount(weth, ethFromKyber.toString())
        ),
      ]).catch(console.log);
      const daiFromKyber = ethFromUniswap
        .mul(web3.utils.toBN(amountsDai[0].expectedRate))
        .div(ONE_WEI);
      const daiFromUniswap = web3.utils.toBN(amountsDai[1][0].raw.toString());

@ricmoo Thank you so much, Ricmoo! You're right.
I didn't use FallbackProvider(or Ethers.js) directly which is used by "@uniswap/sdk". So I thought the "quorum error " maybe sourced from "@uniswap/sdk". I'm a totally newbie. So could you tell me how to solve these bugs..
BTW, the error log I pasted looks ugly. Sorry for it. Is there a way to make it look more readable?
Thanks again! Below is the code:

const {
  ChainId,
  Token,
  TokenAmount,
  WETH,
  Fetcher,
  Trade,
} = require("@uniswap/sdk");
I checked the [package.js of Uniswap SDK]([https://github.com/Uniswap/uniswap-sdk/blob/v2/package.json#L33).  Below is code related with Ethers:
{
  "name": "@uniswap/sdk",
  "license": "MIT",
  "version": "3.0.3",
  "description": "🛠 An SDK for building applications on top of Uniswap.",
  "main": "dist/index.js",
  "typings": "dist/index.d.ts",
  "files": [
    "dist"
  ],
  "repository": "https://github.com/Uniswap/uniswap-sdk.git",
  "keywords": [
    "uniswap",
    "ethereum"
  ],
  "module": "dist/sdk.esm.js",
  "scripts": {
    "lint": "tsdx lint src test",
    "build": "tsdx build",
    "start": "tsdx watch",
    "test": "tsdx test",
    "prepublishOnly": "tsdx build"
  },
  "dependencies": {
    "@uniswap/v2-core": "^1.0.0",
    "big.js": "^5.2.2",
    "decimal.js-light": "^2.5.0",
    "jsbi": "^3.1.1",
    "tiny-invariant": "^1.1.0",
    "tiny-warning": "^1.0.3",
    "toformat": "^2.0.0"
  },
  "peerDependencies": {
    "@ethersproject/address": "^5.0.0-beta",
    "@ethersproject/contracts": "^5.0.0-beta",
    "@ethersproject/networks": "^5.0.0-beta",
    "@ethersproject/providers": "^5.0.0-beta",
    "@ethersproject/solidity": "^5.0.0-beta"
  },
  "devDependencies": {
    "@ethersproject/address": "^5.0.2",
    "@ethersproject/contracts": "^5.0.2",
    "@ethersproject/networks": "^5.0.2",
    "@ethersproject/providers": "^5.0.5",
    "@ethersproject/solidity": "^5.0.2",
    "@types/big.js": "^4.0.5",
    "@types/jest": "^24.0.25",
    "babel-plugin-transform-jsbi-to-bigint": "^1.3.1",
    "tsdx": "^0.12.3"
  },
  "engines": {
    "node": ">=10"
  },
  "prettier": {
    "printWidth": 120,
    "semi": false,
    "singleQuote": true
  }
}

Hope it to be of any help.

@zemse
Copy link
Collaborator

zemse commented Sep 27, 2020

@zhengger Actually, I haven't used web3 much, I do not know more about it's API.

The interval time of 15 sec is just actuallly fine for ethereum. However I guess that there could be something with your subscription part of code. Since the error 2 (#1067 (comment)) is calling eth_blockNumber rpc. Also you can confirm which part of code gives error, you can simply comment a line or two to see if the error disappears.

await web3.eth
    .subscribe("newBlockHeaders")

What this probably does is constantly making calls to see if block number is incremented. So maybe you need to see how to reduce the rate of constant calling. I tried to look at web3 docs, but couldn't spot a option that does this. Web3.js has a gitter chat https://gitter.im/ethereum/web3.js there you can take help regarding web3.

Other than that, I can recommend you to try plain ethers.js in your next project and use minimum dependencies instead of depending on lot of things, you would have better time fixing any error that might come up with lesser deps than more.

@zhengger
Copy link
Author

Hi @zemse!
Thank you for your detailed answer.
As you said, the error mainly came from too often/many requests to the server:

Error 1: ECONNRESET while making a eth_call request to etherscan backend.

Error 2: TIMEOUT while requsting eth_blockNumber cloudfare backend.

Error 3: ECONNRESET while requesting eth_call alchemy backend.

So maybe it's a possible solution to adjust the frequency of requests although I don't know how to do it..
" web3.eth.subscribe" will not calling the server often because I have used Websocket provider for web3.eth.subscribe so that my client will receive notification only when there is new block created. We know it costs normally more than 15 seconds to create a new block. So I'm not sure why this subscription will cause flood requests to the server..

const ws = new Web3WsProvider(
  "wss://mainnet.infura.io/ws/v3/" + process.env.INFURA_URL_0,
  options
);

@zhengger
Copy link
Author

I found the bug may be sourced from the "Fetcher" in the "@Uniswap/SDK". After replaced the default provider "Fetcher" in the with the existing websocket provider, old errors disapeard were repalced by new errors subsequently.
Here is the new code:

const {ethers} = require("ethers");
const {
  ChainId,
  Token,
  TokenAmount,
  WETH,
  Fetcher,
  Trade,
} = require("@uniswap/sdk");

  // @ts-ignore
  clientConfig: {
    // Useful if requests are large
    maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
    maxReceivedMessageSize: 100000000, // bytes - default: 8MiB

    // Useful to keep a connection alive
    keepalive: true,
    keepaliveInterval: 60000, // ms
  },

  // Enable auto reconnection
  reconnect: {
    auto: true,
    delay: 1000, // ms
    maxAttempts: 10,
    onTimeout: false,
  },
};

const ws = new Web3WsProvider(
  "wss://mainnet.infura.io/ws/v3/" + process.env.INFURA_URL,
  options
);

const web3 = new Web3(ws);

      const daiWeth_Pair = await Fetcher.fetchPairData(
        dai,
        weth,
        new ethers.providers.Web3Provider(ws)  // to replace the default provider. 
      );

Here is the old code.

const {
  ChainId,
  Token,
  TokenAmount,
  WETH,
  Fetcher,
  Trade,
} = require("@uniswap/sdk");

  // @ts-ignore
  clientConfig: {
    // Useful if requests are large
    maxReceivedFrameSize: 100000000, // bytes - default: 1MiB
    maxReceivedMessageSize: 100000000, // bytes - default: 8MiB

    // Useful to keep a connection alive.
    keepalive: true,
    keepaliveInterval: 60000, // ms
  },

  // Enable auto reconnection.
  reconnect: {
    auto: true,
    delay: 1000, // ms
    maxAttempts: 10,
    onTimeout: false,
  },
};

const ws = new Web3WsProvider(
  "wss://mainnet.infura.io/ws/v3/" + process.env.INFURA_URL,
  options
);

// use default provider which is omitted here.

const web3 = new Web3(ws);

      const daiWeth_Pair = await Fetcher.fetchPairData(
        dai,
        weth
      );

Here are the new errors:

New block received. Block # 10957816
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 41)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 42)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 43)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 44)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 45)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 46)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 47)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 48)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 49)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 50)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 51)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 52)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 53)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 54)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 55)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 56)
(node:85901) UnhandledPromiseRejectionWarning: Error: CONNECTION ERROR: Provider started to reconnect before the response got received!
    at Object.PendingRequestsOnReconnectingError (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-core-helpers@1.3.0@web3-core-helpers/lib/errors.js:63:16)
    at /Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:332:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider.reconnect (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:331:28)
    at WebsocketProvider._onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_web3-providers-ws@1.3.0@web3-providers-ws/lib/index.js:149:14)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/Users/zheng/Security/Bots/ArBot/node_modules/_yaeti@0.0.6@yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:228:10)
    at WebSocketConnection.<anonymous> (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/W3CWebSocket.js:201:17)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.handleSocketClose (/Users/zheng/Security/Bots/ArBot/node_modules/_websocket@1.0.32@websocket/lib/WebSocketConnection.js:389:14)
    at TLSSocket.emit (events.js:203:15)
    at Socket._destroy._handle.close (net.js:606:12)
    at TCP.done (_tls_wrap.js:388:7)
(node:85901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 57)

@ricmoo
Copy link
Member

ricmoo commented Aug 24, 2021

I think this issue may be stale, so I'm closing it. If not, please feel free to re-open or start a new issue/discussion.

Thanks! :)

@ricmoo ricmoo closed this as completed Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

3 participants