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

Invalid Websocket headers in 1.0.0-beta.34 #1559

Closed
Matko95 opened this issue Apr 18, 2018 · 6 comments

Comments

@Matko95
Copy link

commented Apr 18, 2018

So the issue came when updating to 1.0.0-beta.34 version, the websocket connection fails to a parity node with the following error.

WebSocket connection to 'wss://kovan.decenter.com:4443/' failed: Error during WebSocket handshake: Unexpected response code: 403

The issue is that in the request headers we have value of Sec-WebSocket-Protocol: undefined which gets handled badly on the node since it's undefined. Reverting the version to 1.0.0-beta.33 fixes the issue.

Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9,sr-RS;q=0.8,sr;q=0.7 Cache-Control: no-cache Connection: Upgrade DNT: 1 Host: kovan.decenter.com:4443 Origin: http://127.0.0.1:8080 Pragma: no-cache Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits Sec-WebSocket-Key: l+ZG48eY3Nt11jph4pXlYA== Sec-WebSocket-Protocol: undefined Sec-WebSocket-Version: 13 Upgrade: websocket User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

@amaurymartiny

This comment has been minimized.

Copy link

commented May 15, 2018

Confirmed.

masonforest added a commit to masonforest/web3.js that referenced this issue May 22, 2018
Fixes ethereum#1559: Remove `Sec-WebSocket-Protocol: undefined` from …
…Websocket headers

The WebSocket constructor in a browser based environment [only takes two
arguments](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
Before we were passing it extra arguments which was causing it to send
invalid headers. This commit ignores all arguments except for the first two.
sohkai added a commit to aragon/aragon that referenced this issue May 28, 2018
Downgrade web3.js to beta.33
Secure websockets apparently do not work in beta.34 :(
ethereum/web3.js#1559
tluthra added a commit to tluthra/balance-manager that referenced this issue Jul 18, 2018
Add autorefresh to accounts
Add an additional web3 instance that uses infura's mainnet websocket
endpoint.  On every new block we simply refresh the balance,
transactions and unique tokens for a given account.

Few things to note:
- ACCOUNT_UPDATE_BALANCES_REQUEST wasn't being used so, removed it.
- accountClearIntervals looks like it was replaced in favor of
accountClearState, so removed that function as well.
- web3 v1.0.0-beta34 that we're using has a bug connecting to any
of the testnets on infura, downgrading to web3 v1.0.0-beta33 fixes
the problem if we want to have a network specific subscription
ethereum/web3.js#1559
tluthra added a commit to tluthra/balance-manager that referenced this issue Jul 18, 2018
Add autorefresh to accounts
Add an additional web3 instance that uses infura's mainnet websocket
endpoint.  On every new block we simply refresh the balance,
transactions and unique tokens for a given account.

Few things to note:
- ACCOUNT_UPDATE_BALANCES_REQUEST wasn't being used so, removed it.
- accountClearIntervals looks like it was replaced in favor of
accountClearState, so removed that function as well.
- web3 v1.0.0-beta34 that we're using has a bug connecting to any
of the testnets on infura, downgrading to web3 v1.0.0-beta33 fixes
the problem if we want to have a network specific subscription
ethereum/web3.js#1559
@tluthra tluthra referenced this issue Jul 18, 2018
3 of 3 tasks complete
ozalexo added a commit to e-maximus/ChronoMint that referenced this issue Aug 3, 2018
e-maximus added a commit to e-maximus/ChronoMint that referenced this issue Aug 3, 2018
frozeman added a commit that referenced this issue Aug 8, 2018
Fixes #1559: Remove `Sec-WebSocket-Protocol: undefined` from Websocke…
…t headers (#1650)

The WebSocket constructor in a browser based environment [only takes two
arguments](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
Before we were passing it extra arguments which was causing it to send
invalid headers. This commit ignores all arguments except for the first two.
@frozeman

This comment has been minimized.

Copy link
Member

commented Aug 8, 2018

Should be fixed in the next release.

@frozeman frozeman closed this Aug 8, 2018

@wodxumingxu

This comment has been minimized.

Copy link

commented Aug 12, 2018

I tried the 1.0.0-beta.35, still not working and the same issue. the 1.0.0-beta.33 works

@Mischi

This comment has been minimized.

Copy link

commented Aug 12, 2018

@frozeman

This comment has been minimized.

Copy link
Member

commented Aug 12, 2018

The next release will be .36 try the 1.0 branch please.

@wodxumingxu

This comment has been minimized.

Copy link

commented Aug 12, 2018

thank you guys for the clarification

felipewer added a commit to felipewer/scheduler-listener that referenced this issue Aug 17, 2018
pavelb26 added a commit to zapproject/truffle-hdwallet-provider that referenced this issue Sep 14, 2018
ipetrovic11 added a commit to workchainio/web3.js that referenced this issue Nov 12, 2018
Update index.js in WebSocket provider
Related to: ethereum#1559
WebSocket implementation in older browsers still pass "Sec-WebSocket-Protocol: undefined" if protocols is passed as undefined or null.

This solution will prevent it.
gorgos pushed a commit to PoolX-DutchX/poolx-www that referenced this issue Feb 17, 2019
Downgrade web3 to beta33
• beta34 has broken websockets ethereum/web3.js#1559
• beta36 seemiingly can't be downloaded from npm yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.