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

Calling contract.getPastEvents or contract.events.allEvents() throws error SubscriptionError: Failed to get past events., if there is no matching events #6644

Closed
Muhammad-Altabba opened this issue Dec 6, 2023 · 0 comments · Fixed by #6647
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@Muhammad-Altabba
Copy link
Contributor

Actual behavior

When calling contract.events.allEvents(...), if there is no previous events to get, the following error came:

Error: Unhandled error. (SubscriptionError: Failed to get past events.
    at /home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:1341:8
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: TypeError: Cannot read properties of undefined (reading 'map')
      at Contract.map (/home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:909:28)
      at Generator.next (<anonymous>)
      at fulfilled (/home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:9589:24)
      at processTicksAndRejections (node:internal/process/task_queues:95:5),
  code: 603
})
    at new NodeError (node:internal/errors:388:5)
    at EventEmitter.emit (node:events:526:17)
    at LogsSubscription.emit (/home/maltabba/repos/web3v4.x/packages/web3-core/src/web3_event_emitter.ts:49:17)
    at /home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:11715:15
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_UNHANDLED_ERROR',
  context: SubscriptionError: Failed to get past events.
      at /home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:1341:8
      at processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: TypeError: Cannot read properties of undefined (reading 'map')
        at Contract.map (/home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:909:28)
        at Generator.next (<anonymous>)
        at fulfilled (/home/maltabba/repos/web3v4.x/packages/web3-eth-contract/src/contract.ts:9589:24)
        at processTicksAndRejections (node:internal/process/task_queues:95:5),
    code: 603
  }
}

Environment

web3 v4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
1 participant