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
Closed

Invalid Websocket headers in 1.0.0-beta.34 #1559

Matko95 opened this issue Apr 18, 2018 · 6 comments

Comments

@Matko95
Copy link

Matko95 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

@amaury1093
Copy link

Confirmed.

masonforest added a commit to masonforest/web3.js that referenced this issue May 22, 2018
…ocket 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/client that referenced this issue May 28, 2018
Secure websockets apparently do not work in beta.34 :(
web3/web3.js#1559
tluthra added a commit to tluthra/balance-manager that referenced this issue Jul 18, 2018
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
web3/web3.js#1559
tluthra added a commit to tluthra/balance-manager that referenced this issue Jul 18, 2018
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
web3/web3.js#1559
ozalexo added a commit to e-maximus/ChronoMint that referenced this issue Aug 3, 2018
e-maximus pushed a commit to e-maximus/ChronoMint that referenced this issue Aug 3, 2018
frozeman pushed a commit that referenced this issue Aug 8, 2018
…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
Copy link
Contributor

frozeman commented Aug 8, 2018

Should be fixed in the next release.

@frozeman frozeman closed this as completed Aug 8, 2018
@wodxumingxu
Copy link

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

@Mischi
Copy link

Mischi commented Aug 12, 2018 via email

@frozeman
Copy link
Contributor

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

@wodxumingxu
Copy link

thank you guys for the clarification

felipewer added a commit to felipewer/scheduler-listener that referenced this issue Aug 17, 2018
smartym-pb pushed 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
Related to: web3#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
• beta34 has broken websockets web3/web3.js#1559
• beta36 seemiingly can't be downloaded from npm yet
nachomazzara pushed a commit to nachomazzara/web3.js that referenced this issue Jun 4, 2020
…ocket headers (web3#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants