I am trying to console.log the blockNumber that my transaction was confirmed in with the following code:

    {from:account3, to: account2, value: web3.utils.toWei('1','ether')}
).then(function(receipt) {console.log(receipt.blockNumber)}

Node.js then sends me the following UnhandledPromiseRejectionWarning

(node:11957) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 9)

{ error: Error: Timeout exceeded during the transaction confirmation process. Be aware the transaction could still get confirmed! at _callee2$ (/Users/julianmartinez/node_modules/web3-core-method/dist/web3-core-method.cjs.js:434:36) at tryCatch (/Users/julianmartinez/node_modules/regenerator-runtime/runtime.js:45:40) at Generator.invoke [as _invoke] (/Users/julianmartinez/node_modules/regenerator-runtime/runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (/Users/julianmartinez/node_modules/regenerator-runtime/runtime.js:97:21) at asyncGeneratorStep (/Users/julianmartinez/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24) at _next (/Users/julianmartinez/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9) at processTicksAndRejections (internal/process/task_queues.js:86:5),

At the same time that I receive the previous error, I also receive the transaction receipt, but it does not console.log the block number.

Any idea about what is going on?

  • Which version of web3 do you use? – n1c01a5 Jul 20 at 21:31
  • web3 version 1.0.0-beta.55 – Julian Martinez Jul 21 at 1:18
  • 1
    I'd suggest to try with web3 v1.2 (which is 1.0.0-beta.37), new versions have odd bugs. – Ismael Jul 24 at 19:17
  • I ended up doing this. This helped out a lot. Thank you for the info. – Julian Martinez Jul 27 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.