Getting disconnected when attempting to use web3.eth.getBlock

Everything was working initially after the new patch went through which fixed the eth_getFilterLogs. However, recently I started getting disconnected when attempting to use web3.eth.getBlock:

The log is as follows:

Disconnected:
_Event {
type: ‘close’,
isTrusted: false,
_yaeti: true

Can you advise why this is happening?

Hi @atfwins, Can you provide us with the web3.eth.getBlock code you’re using to get that log?

Hi Leiya,

The code is not complicated and it was working for a long time until a few hours after the eth_getFilterLogs fix was released.


var provider = new Web3.providers.WebsocketProvider (“wss://mainnet.infura.io/ws/[MY PROJECT ID]”);
web3 = new Web3(provider)

provider.on(‘end’, (eventObj) => {
console.log(eventObj);
}

let checkedblock = await web3.eth.getBlock(100000, true);


This should be a very basic retrieval of the block, but it causes the connection to disconnect instead.

I want to reiterate again that everything was working for months before the fix and it worked a couple hours after the fix. So I know this code is functional, something has to have changed on Infura’s end.

Also @Leiya_Kenney, I believe the issue is with the parameter “true” in

let checkedblock = await web3.eth.getBlock(100000, true);

When I don’t add that parameter the function works.

However, I need to set it to true for my purposes as I need the block as an object of transactions, not just the transaction hashes.

Got it - thanks for the additional context. I’ll reach out to the team and see if they can figure out what’s going on.

Nothing changed on our end outside of the original fix, and the getBlock shouldn’t have been affected by the getFilterLogs fix.

Is this something you’re able to reproduce? A couple of us have tried to reproduce this and aren’t seeing the same results.

Hi @Leiya,

It seems to be working again. Strange, I didn’t change anything but after retrying a few times it now works. Thanks for checking on it for me.