-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Couldn't connect to node on WS (using getBlock method at #599275 ropsten) #3388
Comments
I think in 599275, there's 1077 transactions in it. Is there any way to overcome it? |
@rlaace423 Can confirm that Ropsten 599275 is a problem when calling Infura over Websockets with:
This looks like it works:
It also works for full tx objects using an Http provider instead of Websockets. Are either of those options for you? |
@rlaace423 Actually, just got it to work as expected by using a suggestion in this #1217 comment. It's possible to set the websocket frame size limits larger when instantiating the provider, const web3 = new Web3(new Web3.providers.WebsocketProvider(
'wss://ropsten.infura.io/ws/v3/<projectID>',
{
clientConfig: {
maxReceivedFrameSize: 100000000,
maxReceivedMessageSize: 100000000,
}
}
)); This needs to be added to the documentation. |
@cgewecke Thank you for your help! In my situation, I can't handle Web3 constructor because it resides in 3rd party library (https://github.com/bitpay/bitcore). Also, I've already tried #1217 (comment), but had no luck. |
@rlaace423 I just ran this script and it worked... index.js const Web3 = require('web3');
const util = require('util');
async function main(){
const web3 = new Web3(new Web3.providers.WebsocketProvider(
'wss://ropsten.infura.io/ws/v3/<infura-project-id>', // <-- Put your projectID here
{
clientConfig: {
maxReceivedFrameSize: 100000000,
maxReceivedMessageSize: 100000000,
}
}
));
const block = await web3.eth.getBlock(599275, true);
console.log(util.inspect(block))
}
main()
.then(() => process.exit(0))
.catch(err => {
console.log(err);
process.exit(1)
}); Run
Could you double-check that?
Do you mean you can't configure the provider? |
I found that I only tested with maxReceivedFrameSize, and I figured out maxReceivedMessageSize must be used together! I works like a charm :) And, yes, I cannot configure the provider. But I can pull-request this. Thank you! |
@rlaace423 I'm going to track the documentation need raised here via PR 3402 if that's ok with you. Please just ping if you'd like this re-opened / think more should be done here. |
Expected behavior
fetch block information
Actual behavior
Error with message like

Steps to reproduce the behavior
web3.eth.getBlock(599275, true);
Logs
Versions
nodejs : v10.16.3
npm : v6.13.2
web3 : v1.2.6
os : ubuntu 16.04
The text was updated successfully, but these errors were encountered: