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
Web socket proxying does not work with Node.js v11 and above #9
Comments
How are you using |
I was trying to go without modifying the programm. Full command I switched between node versions serveral times, and did exactly the same npm install and run above command. Older version works fine, newer gives this error. |
$ node -v
v12.4.0
$ cat main.js
const got = require('got');
const main = async () => {
await got('http://gajus.com');
console.log('OK');
};
main();
$ export GLOBAL_AGENT_HTTP_PROXY=http://127.0.0.1:8020
$ node -r 'global-agent/bootstrap' main.js
OK
Cannot replicate the issue. |
I'm so sorry. For the lack of detail so far (regarding main.js). This is the script I'm running (main.js)
package.json
The error appears when first connecting to the server the script creates.
I also just now reproduced on a linux system running node v11.15.0.
I'm not sure if maybe the script is buggy, but the error-message made me believe it's part of global-agent :) |
Do you say that this work on Node.js <v12? I don't think the current implementation supports WebSockets. |
I am trying to use global-agent to pass websocket traffic through https://github.com/nccgroup/wssip So if you say you would expect websockets to fail that is an explanation, strange nontheless (or even stranger). |
Could you please create a failing test case? With a failing test case I will be able to add the missing feature. Web sockets is not something I use that much. |
I've just been through quite a journey trying to pinpoint the issue I'm having. (TL;DR at bottom) First I reduced above script to a most basic test-case: Creating a server and connecting to itself, sending a "test". Result: proxytest.zip At first I was able to use this minimal script to reproduce the exact behavior I initially observed using node 10 and 12. Fast forward about 3 hours. I wanted to test a couple more node versions before reporting back, so I grabbed releases of node 9, 10 and 11. 10: worked as expected! that last one surprised me, so I retested using node v12... and it worked as well. At that stage I was very puzzled. The only difference between the two runs using v12 was that I deleted all node_modules (tested a bunch of other versions) and reinstalled everything 3h later. Fair enough, when I started testing I was using 1.12.1, but I put ^1.12.1 into the package.json, so later I was pulling 1.12.2 (checking the commit/release log the timeline adds up!). Using node v11.15 I retested global-agent 1.12.1 and got the error again. Switching back and forth with 1.12.2 I was able to reproduce on 11.12.1 but not on 1.12.2, so I ended my endeavors there. TL;DR: The issue isn't present in 1.12.2 anymore, so... thanks for that :D I will keep an eye out should the error return, but I guess for now this issue is no longer needed. Sorry that this became a bit longer, I wrote it while doing the tests and was questioning my sanity somewhere around the middle... I want to end by apologizing for the chaotic issue. I'm at my very first steps with a lot of the technologies involved in this current project. So thank you for your patience, and I hope you don't mind if another "noob issue" like this would be opened in the future. Have a great weekend :) |
Thank you for detail follow up. It is probably fixed by f17386d. I found that some packages (e.g. https://github.com/kevva/caw) sit as dependencies of other popular packages (e.g. |
When using node version v12.4.0 I get the following error when initiating a connection:
Using node v10.16.0 seems to work as expected. I'm running a super minimal node script (I could share if helpful) and use global-agent via "node -r" option.
I know very little about node and this project, so please let me know if a) the newer node is supported at all b) I can supply any other information to be helpful with this issue.
Best regards,
Tyrius
The text was updated successfully, but these errors were encountered: