Skip to content
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

Websocket closes immediately in < beta41, "too many arguments" err with beta41 #2327

Closed
gnorbsl opened this issue Feb 5, 2019 · 6 comments
Closed
Labels
Bug Addressing a bug

Comments

@gnorbsl
Copy link

gnorbsl commented Feb 5, 2019

Expected behavior

Connect to geth over websocket.

Actual behavior

instance=Geth/v1.9.0-unstable-7c60d0a6/linux-amd64/go1.11.5

on beta < 41 the websocket closes immediately after opening it, .on('end') reports a normal closure. Node doesn't report anything.

With beta 41 Node throws error INFO [02-05|15:07:53.142] Served eth_subscribe conn= reqid=1 t=34.22µs err="too many arguments, want at most 1"

on latest geth stable instance=Geth/v1.8.22-stable-7fa3509e/linux-amd64/go1.11.5 with beta 41 I get this error:

/home/patric/WebstormProjects/cbc-backend/node_modules/web3-providers/dist/web3-providers.cjs.js:304
    event = this.getSubscriptionEvent(response.params.subscription);
                                                      ^

TypeError: Cannot read property 'subscription' of undefined
at WebsocketProvider.onMessage (/home/patric/WebstormProjects/cbc-backend/node_modules/web3-providers/dist/web3-providers.cjs.js:304:59)
at WebsocketProvider.onMessage (/home/patric/WebstormProjects/cbc-backend/node_modules/web3-providers/dist/web3-providers.cjs.js:410:77)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (/home/patric/WebstormProjects/cbc-backend/node_modules/yaeti/lib/EventTarget.js:115:12)
at W3CWebSocket.onMessage (/home/patric/WebstormProjects/cbc-backend/node_modules/websocket/lib/W3CWebSocket.js:234:14)
at WebSocketConnection.<anonymous> (/home/patric/WebstormProjects/cbc-backend/node_modules/websocket/lib/W3CWebSocket.js:205:19)
at emitOne (events.js:116:13)
at WebSocketConnection.emit (events.js:211:7)
at WebSocketConnection.processFrame (/home/patric/WebstormProjects/cbc-backend/node_modules/websocket/lib/WebSocketConnection.js:552:26)
at /home/patric/WebstormProjects/cbc-backend/node_modules/websocket/lib/WebSocketConnection.js:321:40
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)

Steps to reproduce the behavior

install latest geth stable
install latest web3js
try to establish websocket connection with

    const wsProvider = new Web3.providers.WebsocketProvider('ws://' + process.env.nodeHost + ':' + process.env.nodePort, {
        headers: {
            Origin: process.env.nodeApiKey
        }
    });

Error Logs

Versions

$ npm -v
6.7.0
$ node -v
v8.15.0

@nivida nivida added the Bug Addressing a bug label Feb 5, 2019
@nivida
Copy link
Contributor

nivida commented Feb 5, 2019

Thanks for submitting this issue! Will check and fix it asap.

@gnorbsl
Copy link
Author

gnorbsl commented Feb 5, 2019

I found that the node returns {"jsonrpc":"2.0","error":{"code":-32600,"message":"unexpected EOF"}} but I wasn't able to figure out why and where so far.

@nivida
Copy link
Contributor

nivida commented Feb 6, 2019

I think we already had this discussion here: #1217 (comment)

This should be the solution for you. I will write it down on my check-list maybe I find a better solution.

@nivida nivida closed this as completed Feb 6, 2019
@gnorbsl
Copy link
Author

gnorbsl commented Feb 6, 2019

        const wsProvider = new Web3.providers.WebsocketProvider('ws://' + process.env.nodeHost + ':' + process.env.nodePort, {
        headers: {
            Origin: process.env.nodeApiKey
        },
        clientConfig: {
            maxReceivedFrameSize: 100000000,
            maxReceivedMessageSize: 100000000,
        }
    });

is not fixing the problem, neither in beta37 nor in beta41, clientOptions doesnt work either.

I still get a 'Normal connection closure', event in beta37 and a undefined subscription in beta41

Also @nivida it would be nice if you close the issue AFTER you get confirmation that something is fixed. Because this bug is not fixed.

@gnorbsl
Copy link
Author

gnorbsl commented Feb 8, 2019

@nivida

@richardliebmann
Copy link

richardliebmann commented May 1, 2019

@gnorbsl: My mistake was an incorrect request in the batch. Maybe the error output can be more clear.

Incorrect request:
web3.eth.getTransaction.request(transactionHash, 'latest', callback)

Should be:
web3.eth.getTransaction.request(transactionHash, callback)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

3 participants