Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

[web3@1.0.0-beta.41] getPastEvents not working - {"code":-32603,"message":"request failed or timed out"} #2311

@ironheart122

Description

@ironheart122

Expected behavior

Fetch all past events starting with a given block number

Actual behavior

It always return the following error:

Error: Node error: {"code":-32603,"message":"request failed or timed out"}

Downgrading back to web3@1.0.0-beta.37 fixes the issue.

Steps to reproduce the behavior

const httpProvider = new Web3.providers.HttpProvider(infuraHTTPProviderURL);
const web3Instance = new Web3(httpProvider);
const coreContractInstance = new web3Instance.eth.Contract(coreABI, coreContractAddress);

coreContractInstance.getPastEvents('Birth', { fromBlock: 3768892 })
  .then((pastBirthEvents) => { debug('pastBirthEvents: %O', pastBirthEvents) })
  .catch((error) => { debug('error: ', error); process.exit(1) });

Error Logs

(node:379) UnhandledPromiseRejectionWarning: Error: Node error: {"code":-32603,"message":"request failed or timed out"}
    at Function.validate (/home/****/projects/*********/crypto-kitty-midwife/node_modules/web3-providers/dist/web3-providers.cjs.js:66:18)
    at /home/****/projects/*********/crypto-kitty-midwife/node_modules/web3-providers/dist/web3-providers.cjs.js:128:57
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:379) 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:379) [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.

Versions

[NPM, Node, Web3.js, OS, device...]

web3@1.0.0-beta.41
node@v8.14.0
npm@6.5.0
OS: Linux/Ubuntu 18.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAddressing a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions