Skip to content

Fix bug in proxy where HTTPS_PROXY became 'undefined' #3913

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

Merged
merged 4 commits into from
Apr 9, 2019

Conversation

flotwig
Copy link
Contributor

@flotwig flotwig commented Apr 8, 2019

This is the bug causing the failing AppVeyor build, basically the agent was always trying to use a proxy set to string "undefined" when no proxy is defined, making the request fail catastrophically every time.

Appveyor build: https://ci.appveyor.com/project/cypress-io/cypress-test-example-repos/builds/23690466

The issue causing the actual crash was that socket.io was somehow ACK'ing with a circular reference because of the error:

Mon, 08 Apr 2019 19:51:45 GMT socket.io-parser decoded 210["backend:request","http:request",{"url":"https://jsonplaceholder.cypress.io/users","method":"GET","gzip":true,"timeout":30000,"followRedirect":true}] as {"type":2,"nsp":"/","id":10,"data":["backend:request","http:request",{"url":"https://jsonplaceholder.cypress.io/users","method":"GET","gzip":true,"timeout":30000,"followRedirect":true}]}
Mon, 08 Apr 2019 19:51:45 GMT socket.io:socket got packet {"type":2,"nsp":"/","id":10,"data":["backend:request","http:request",{"url":"https://jsonplaceholder.cypress.io/users","method":"GET","gzip":true,"timeout":30000,"followRedirect":true}]}
Mon, 08 Apr 2019 19:51:45 GMT socket.io:socket emitting event ["backend:request","http:request",{"url":"https://jsonplaceholder.cypress.io/users","method":"GET","gzip":true,"timeout":30000,"followRedirect":true}]
Mon, 08 Apr 2019 19:51:45 GMT socket.io:socket attaching ack callback to event
Mon, 08 Apr 2019 19:51:45 GMT socket.io:socket dispatching an event ["backend:request","http:request",{"url":"https://jsonplaceholder.cypress.io/users","method":"GET","gzip":true,"timeout":30000,"followRedirect":true},null]
.......some more Cypress logs here........
Mon, 08 Apr 2019 19:51:47 GMT socket.io:socket sending ack [Circular]
RangeError: Maximum call stack size exceeded

This is known to crash socket.io: socketio/socket.io-parser#80

I fixed the proxy issue where process.env.HTTPS_PROXY was becoming "undefined" and added a test, but I'm still unsure as to how this manifested into the circular ack bug we got here.

@flotwig flotwig changed the title [WIP] Fix bug in proxy where HTTPS_PROXY became 'undefined' Fix bug in proxy where HTTPS_PROXY became 'undefined' Apr 9, 2019
@flotwig flotwig requested review from brian-mann and bahmutov April 9, 2019 18:05
@brian-mann brian-mann merged commit 2d6e13b into develop Apr 9, 2019
laurinenas pushed a commit to laurinenas/cypress that referenced this pull request Apr 28, 2019
* server: fix bug in proxy where HTTPS_PROXY became 'undefined'

* server: loose undefined check

* allow empty string, 0, false to disable proxy

* fix failing tests
@flotwig flotwig deleted the fix-appveyor-kitchensink-build branch January 24, 2022 18:18
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

Successfully merging this pull request may close these issues.

2 participants