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

Unhandled promise rejection on web3.eth.sendSignedTransaction #6900

Open
arijoon opened this issue Mar 14, 2024 · 4 comments
Open

Unhandled promise rejection on web3.eth.sendSignedTransaction #6900

arijoon opened this issue Mar 14, 2024 · 4 comments
Labels
4.x 4.0 related Feature Request P3 Low severity bugs

Comments

@arijoon
Copy link

arijoon commented Mar 14, 2024

Expected behavior

If server is closed during sendTransaction, process should not crash and exception must bubble up allowing the caller to catch it
Under no circumstances the lib should be throwing unhandled exceptions and damaging the underlying process

Actual behavior

Unhandled exception is thrown and crashes the process

Steps to reproduce the behavior

  1. Create a mock server (simple express server would do)
  2. Set your mock server as the rpc url and construct web3 provider
  3. sign a tx and use web3.eth.sendSignedTransaction
  4. Mock a response to only the send part
  5. Close the server after send

Logs

    FetchError: request to http://localhost:63799/ failed, reason: connect ECONNREFUSED 127.0.0.1:63799

      at ClientRequest.<anonymous> (../.yarn/__virtual__/node-fetch-virtual-6f667efda9/3/home/USER/.yarn/berry/cache/node-fetch-npm-2.6.12-48619ce9d6-10c0.zip/node_modules/node-fetch/lib/index.js:1505:11)

Environment

Ubuntu
web3: v4.4.0
node: v18.18.2

@SantiagoDevRel
Copy link
Member

Hey @arijoon thanks for submiting this, i'll ping the devs, could u pls provide the code/repo to try to reproduce it as well?
Thanks!

@arijoon
Copy link
Author

arijoon commented Mar 14, 2024

sure I'll try to make a sample repo for it over the weekend. For now I've opted to directly use sendRawTransaction from web3-rpc-methods as sendTransaction is doing the same under the hood and then waits for receipt which is undesired for our case

@SantiagoDevRel
Copy link
Member

Amazing, I appreciate it a lot👍

@SantiagoDevRel SantiagoDevRel added the 4.x 4.0 related label Mar 14, 2024
@arijoon
Copy link
Author

arijoon commented Mar 14, 2024

Added a repo here: https://github.com/arijoon/web3-6900-reproduction

dependency versions used are in the readme but easiest to use nix to get a guarantee of a reproducible env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Feature Request P3 Low severity bugs
Projects
None yet
Development

No branches or pull requests

3 participants