Web3.js: [1.0.0-beta.48] Contract.methods.myMethod.send() hangs forever

Created on 6 Mar 2019  路  6Comments  路  Source: ChainSafe/web3.js

Description

I'm using HDWalletProvider with Infura API, and when I use HTTP API like

const web3 = new Web3(new HDWalletProvider(P_KEY, `https://${NETWORK}.infura.io/v3/${INFURA_API_KEY}`));
const contract = new web3.eth.Contract(ABI, CONTRACT_ADDRESS);
contract.methods.transfer(ETH_ADDRESS, 12345).send(defaultOption)
    .on('receipt', (res) => { ... });

This sends the transaction correctly, but crashes after with

Error: Subscriptions are not supported with the CustomProvider.

I saw "The HTTP provider is deprecated" on the web3 document, so I changed the Infura endpoint using Websocket:

const web3 = new Web3(new HDWalletProvider(P_KEY, `wss://${NETWORK}.infura.io/ws/v3/${INFURA_API_KEY}`));

This doesn't send the transaction at all and just hangs forever (no error, nothing happens).

Expected behavior

Calling

contract.methods.transfer(ETH_ADDRESS, 12345).send(defaultOption).on('receipt', (res) => { ... });

should sent the transaction and receipt event should be triggered.

Actual behavior

It doesn't send the transaction and receipt event doesn't get triggered.

Versions

  • web3.js: 1.0.0-beta.48
  • nodejs: v11.10.1
  • browser: console
  • ethereum node: Infura websocket
bug

Most helpful comment

Thanks for opening this issue! I will fix and release it asap.

All 6 comments

Thanks for opening this issue! I will fix and release it asap.

what's the fix for this ? I have the same issue

@nivida any plan to release this fix with beta.49 soon?

@sydneyitguy Yes, after I've improved the transaction confirmation workflow for having better confirmations. I think this will happen this weekend or at the beginning of next week.

@sydneyitguy Yes, after I've improved the transaction confirmation workflow for having better confirmations. I think this will happen this weekend or at the beginning of next week.

but this issue must be put on Open

I have the similar problem that I can send the transaction and verify it in remix but it hangs when receiving the receipt.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TinyWJL picture TinyWJL  路  3Comments

sundbry picture sundbry  路  3Comments

baxy picture baxy  路  3Comments

webersson picture webersson  路  3Comments

zamoore picture zamoore  路  3Comments