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

Did the 'error' event listener get removed in v6, like provider.on('error', () => {})? #3970

Open
crycime opened this issue Apr 12, 2023 · 13 comments
Assignees
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. on-deck This Enhancement or Bug is currently being worked on. v6 Issues regarding v6

Comments

@crycime
Copy link

crycime commented Apr 12, 2023

Ethers Version

6.2.3

Search Terms

No response

Describe the Problem

Did the 'error' event listener get removed in v6, like provider.on('error', () => {})?

Code Snippet

await provider.on('error', (error) => {
      this.logger.error(`Connection error for chainId ${chainId}. Reconnecting...`, error);
      setTimeout(() => this.setupProviderEvents(provider, chainId), 1000);
    });

Contract ABI

No response

Errors

unhandledRejection TypeError: unknown ProviderEvent (argument="event", value="error", code=INVALID_ARGUMENT, version=6.3.0)

Environment

No response

Environment (Other)

No response

@crycime crycime added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Apr 12, 2023
@crycime crycime changed the title Add Bug Title Here Did the 'error' event listener get removed in v6, like provider.on('error', () => {})? Apr 12, 2023
@mpsq
Copy link

mpsq commented Apr 13, 2023

This seems to be similar and / or related to #3952

@0xSidius
Copy link

0xSidius commented Apr 15, 2023

@ricmoo what happened to ProviderEvents? they seem all gone... (same behavior with 6.3.0)

image

image

@ricmoo
Copy link
Member

ricmoo commented Apr 15, 2023

This will be added in the next minor version. I'm currently trying to figure out the best way to abstract all the possible ways things can go wrong, so an extendable type can be provided for future internal errors.

@0xSidius
Copy link

This will be added in the next minor version. I'm currently trying to figure out the best way to abstract all the possible ways things can go wrong, so an extendable type can be provided for future internal errors.

Thank you, any workaround meanwhile? use window.ethereum.on?

@MarinBarac
Copy link

MarinBarac commented May 10, 2023

Is there any update about this problem? I am still facing same issue.

@ricmoo
Copy link
Member

ricmoo commented May 10, 2023

It’s fixed in main, but not published yet. There are two small issues I want to include in the minor bump that fixes this. Should be published on npm soon.

@hans-crypto
Copy link

hans-crypto commented May 16, 2023

These hidden errors are a real showstopper, is there anything I can help you with so that the release can be published? 🙂

I'm also concerned about this "error handling" for listeners, both for the high-level api and the low-level api:

} catch (error) { }

And especially this:

} catch (error) { console.log("@TODO", error); }

I simulate a serious problem by restarting my hardhat test network. Then the whole application gets stuck and there is no way to recover from this bogus state:

@TODO TypeError: results is not iterable
    at FilterIdEventSubscriber._emitResults (/Users/xxx/node_modules/ethers/src.ts/providers/subscriber-filterid.ts:159:30)
    at FilterIdEventSubscriber.#poll (/Users/xxx/node_modules/ethers/src.ts/providers/subscriber-filterid.ts:96:24)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Errors are silently catched everywhere and there is also no global error event listener that could be used to reset the connection.

@ricmoo
Copy link
Member

ricmoo commented May 20, 2023

Added in v6.4.0.

Thanks! :)

@ricmoo ricmoo closed this as completed May 20, 2023
@ricmoo ricmoo added enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. and removed investigate Under investigation and may be a bug. labels May 20, 2023
@hedgehog-millenium
Copy link

Event after updating to v6.4.0 the issue is still there

@ricmoo ricmoo reopened this Jun 2, 2023
@ricmoo
Copy link
Member

ricmoo commented Jun 2, 2023

I’ll look into this in the morning.

@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label Jun 2, 2023
@travisbotello
Copy link

Is this still pending?

Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
Woodpile37 pushed a commit to Woodpile37/ethers.js that referenced this issue Jan 14, 2024
@zekeluo
Copy link

zekeluo commented Mar 23, 2024

Did you fix?

@pbrisson
Copy link

Using v6.13.2 I'm still getting the error. It only seems present using a local hardhat node, so I suspect that "non-iterable results" happens when no transaction is made on the block. That would explain why it won't happen in production as several transactions are available on every new block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published. on-deck This Enhancement or Bug is currently being worked on. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

10 participants