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

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
1 participant