heroku / legacy-cli

Heroku CLI
https://cli.heroku.com
MIT License
1.37k stars 380 forks source link

Invalid proxy #923

Open mendet opened 10 years ago

mendet commented 10 years ago

heroku PROBLEM - getting following error after trying any command line statement in heroku: "Error:Proxy is invalid (Excon::Errors::ProxyParseError)"

Last backtrace statement = C:/Program Files (x86)/Heroku/vendor/gems/excon-0.25.3/lib/excon/connection.rb:376:in `setup_proxy'

I am working behind a corp firewall and my environment HTTP_PROXY variable = "http-proxy2.companyx.com:8080". I also have a HTTPS_PROXY env variable set up with the same value.

After typing in any command such as "heroku --version", the uri.host, uri.port and uri.scheme values returned from connection.rb - setup_proxy - URI.parse(proxy) are all null, thus causing the error above.

If I hard-wire the values in connection.rb as follows, everything appears to work fine,however, I'm sure this isn't best practice... :host => "http-proxy2.companyx.com", :password => uri.password, :port => "8080", :scheme => "HTTP", :user => uri.user

Does anyone know of an issue with URI.parse which causes this sort of thing?

pedro commented 10 years ago

Interesting, I think you just need to add a scheme to HTTP_PROXY, eg: http://http-proxy2.companyx.com:8080.

Can you check if that works? If so we might just want to handle this better by defaulting to http or rendering an error that explains what happened.

mendet commented 10 years ago

I tried adding the scheme http:// - same results. FYI this is all part of Michael Hartl's "first_app" tutorial. I'm going thru each step and, I believe, since I'm working behind this firewall I'm hitting these types of situations. Even though I got through the "heroku login" step by hard-coding these proxy values in connection.rb's setup_proxy (above), I just hit another wall when trying a "heroku create" via CLI. Similar type of thing in "getaddrinfo" in socket.rb - it throws a "No such host is known" error - and I cannot seem to find any workaround for this one. I think this is all proxy related.

mendet commented 10 years ago

I believe I got past this. When I hard-coded the values in connection.rb, I put the port name in quotes. When I removed them I was able to execute a "create". I think it's obvious that hard-coding anything is not good,so the original problem statement remains.

      :host       => 'http-proxy2.companyx.com',
      :password   => uri.password,
      :port       => 8080,
      :scheme     => 'http',
      :user       => uri.user   
pedro commented 10 years ago

Ah! Excellent find.

But so why did you have to hard-code the proxy in first place, was it not being used? Or not sending the right values over?

mendet commented 10 years ago

Correct - it appears that URI.parse is not parsing the proxy value correctly (called in connection.rb) as the values such as :host, :port, etc. are coming back as nil. Additionally, even though I got past this, albeit not a permanent fix, I am completely dead in the water when trying to deploy the app up to Heroku. It appears that a git push will not work when executing from behind a corporate firewall.