Unhandled promise rejection on `web3.eth.sendSignedTransaction`
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
- Create a mock server (simple express server would do)
- Set your mock server as the rpc url and construct web3 provider
- sign a tx and use
web3.eth.sendSignedTransaction - Mock a response to only the send part
- 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
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!
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
Amazing, I appreciate it a lot👍
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