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

Hangs behind HTTP Proxy #785

Closed
Toilal opened this issue Feb 5, 2018 · 24 comments
Closed

Hangs behind HTTP Proxy #785

Toilal opened this issue Feb 5, 2018 · 24 comments

Comments

@Toilal
Copy link

Toilal commented Feb 5, 2018

Version

3.0.0-alpha.8

Steps to reproduce

Run vue create on a computer configured with a corporate HTTP Proxy

(http_proxy and https_proxy environment variable are defined, everything else is working properly)

What is expected?

It should run as usual

What is actually happening?

vue create command hangs forever with no prompt at all.


Tested on Windows and Ubuntu.

@yyx990803
Copy link
Member

yyx990803 commented Feb 6, 2018

Did it work with any earlier versions?

It's a bit difficult for me to simulate your actual environment, but it probably hangs here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/getVersions.js#L17

I don't quite know why though because axios does automatically handle https_proxy env variables.

@Toilal
Copy link
Author

Toilal commented Feb 6, 2018

I'll try to debug this at work. That's the first time I try v3 here, and it was working properly with v2.

@ayush987goyal
Copy link

Getting the following error with @vue/[email protected] for vue create my-app

ERROR  Error: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827:

Error: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827:

    at _errnoException (util.js:1024:11)
    at WriteWrap.afterWrite [as oncomplete] (net.js:867:14)

@marco-carvalho
Copy link

Getting this error with @vue/[email protected] for vue create randomapp

ERROR Error: connect ETIMEDOUT
Error: connect ETIMEDOUT
at Object._errnoException (util.js:1003:13)
at _exceptionWithHostPort (util.js:1024:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1194:14)

@wadetandy
Copy link
Contributor

Can confirm the same here using http proxy.

@SMoni
Copy link

SMoni commented Feb 12, 2018

Experienced a similar problem on Windows without the hanging but with a ERROR: connect ECONNREFUSED.

Could solve the error by manually set HTTP_PROXY and HTTPS_PROXY. Then it became a Error: socket hang up.

After changing the line

https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/getVersions.js#L15

to http://registry.npmjs.org I still get the same error, but through the line

https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/installDeps.js#L19

which could be solved by npm config set registry http://registry.npmjs.org/

I hope nobody mind my question: In https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/installDeps.js#L46 the user settings are respected. In https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/getVersions.js#L17 not. Is there a purpose to do that?

@Toilal
Copy link
Author

Toilal commented Feb 12, 2018

Maybe it's related to this axios issue : axios/axios#925

@yyx990803
Copy link
Member

If this is an axios issue we can switch to a different HTTP client. Can anyone try it out? I don't have the network environment to confirm whether that would fix it.

@SMoni
Copy link

SMoni commented Feb 12, 2018

I'm going to give it a try tomorrow and providing feedback.

@Toilal
Copy link
Author

Toilal commented Feb 12, 2018

Maybe https://github.com/request/request ? It's stated in the axios issue that this use case works out of the box with request.

@wadetandy
Copy link
Contributor

Have verified changing out request works in my environment. Unless someone else is already working on this I will put together a PR.

wadetandy added a commit to wadetandy/vue-cli that referenced this issue Feb 12, 2018
Closes vuejs#785

Axios has a [known issue](axios/axios#658)
that causes requests to hang when accessing an HTTPS resource via a
proxy served over HTTP.  This changes out the axios dependency for the
[request](https://github.com/request/request) library. In order to keep
`async/await` conventions easy, I also dropped in the
[request-promise-native](https://github.com/request/request-promise-native)
dependency.
wadetandy added a commit to wadetandy/vue-cli that referenced this issue Feb 12, 2018
Closes vuejs#785

Axios has a [known issue](axios/axios#658)
that causes requests to hang when accessing an HTTPS resource via a
proxy served over HTTP.  This changes out the axios dependency for the
[request](https://github.com/request/request) library. In order to keep
`async/await` conventions easy, I also dropped in the
[request-promise-native](https://github.com/request/request-promise-native)
dependency.
wadetandy added a commit to wadetandy/vue-cli that referenced this issue Feb 12, 2018
Closes vuejs#785

Axios has a [known issue](axios/axios#658)
that causes requests to hang when accessing an HTTPS resource via a
proxy served over HTTP.  This changes out the axios dependency for the
[request](https://github.com/request/request) library. In order to keep
`async/await` conventions easy, I also dropped in the
[request-promise-native](https://github.com/request/request-promise-native)
dependency.
@yyx990803
Copy link
Member

yyx990803 commented Feb 12, 2018

Thanks @wadetandy !

Code changes look good to me. Can someone else in this thread try out #829 to see if that fixes it for you?

@SMoni
Copy link

SMoni commented Feb 12, 2018

Going to check this in the morning, but's looking good.

yyx990803 pushed a commit that referenced this issue Feb 12, 2018
)

Closes #785

Axios has a [known issue](axios/axios#658)
that causes requests to hang when accessing an HTTPS resource via a
proxy served over HTTP.  This changes out the axios dependency for the
[request](https://github.com/request/request) library. In order to keep
`async/await` conventions easy, I also dropped in the
[request-promise-native](https://github.com/request/request-promise-native)
dependency.
@Toilal
Copy link
Author

Toilal commented Feb 13, 2018

Thanks, it's working fine now for me !

@SMoni
Copy link

SMoni commented Feb 13, 2018

Also thanks, it's working for me too. At least if I hadn't muddled up some settings for our proxy :/

@marco-carvalho
Copy link

marco-carvalho commented Feb 19, 2018

i'm getting this error using @vue/[email protected] for vue create randomApp

ERROR RequestError: Error: connect ETIMEDOUT 151.101.92.162:443 RequestError: Error: connect ETIMEDOUT 151.101.92.162:443 at new RequestError (C:\Users\myUser\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\request-promise-core\lib\errors.js:14:15) at Request.plumbing.callback (C:\Users\myUser\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\request-promise-core\lib\plumbing.js:87:29) at Request.RP$callback [as _callback] (C:\Users\myUser\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\request-promise-core\lib\plumbing.js:46:31) at self.callback (C:\Users\myUser\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\request\request.js:186:22) at Request.emit (events.js:160:13) at Request.onRequestError (C:\Users\myUser\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\request\request.js:878:8) at ClientRequest.emit (events.js:160:13) at TLSSocket.socketErrorListener (_http_client.js:389:9) at TLSSocket.emit (events.js:160:13) at emitErrorNT (internal/streams/destroy.js:64:8)

@jnal
Copy link

jnal commented Feb 20, 2018

This workaround work for me..

I have to modified manually the request.js and indicate proxy as part of reqOpts. It doesn't seem to respect the environment variables that I have.

const request = require('request-promise-native')
module.exports = {
  async get (uri) {
    const reqOpts = {
      method: 'GET',
      resolveWithFullResponse: true,
      json: true,
      uri,
	  proxy: 'http://{domain}%5cu{username}:{pass}@proxy.company.com:8080'
    }
    return request(reqOpts)
  }
}

@wadetandy
Copy link
Contributor

@jnal What variables are you using to set proxy normally?

@jnal
Copy link

jnal commented Feb 21, 2018

i have all the variables below set in .npmrc but that doesn't seem to be respected by the request.

proxy=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
https-proxy=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
http-proxy=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
HTTP_PROXY=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
HTTPS_PROXY=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
ignore-ssl=true
strict-ssl=false

some of the settings above might be invalid but I had them anyway just to make sure I am not missiing anything. also in environment variables
HTTP_PROXY=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080
HTTPS_PROXY=http://{domain}%5cu{username}:{pass}@proxy.company.com:8080

also I'm using windows 10, node 8.9.4 and npm 5.6.0 if that helps

@DrDanRyan
Copy link

Did this ever get fixed? I am on 3.0.0 beta 10 and I still can't use vue create behind my corporate proxy.

@wadetandy
Copy link
Contributor

@DrDanRyan this issue was resolved for me and a few others when my pr #829 was merged.

@fizxmike
Copy link

fizxmike commented Jun 27, 2018

@wadetandy , how do I get a release with you PR in it? Version numer? Or does dev branch feed NPM directly? (tried an failed with beta 15)

@wadetandy
Copy link
Contributor

My fix was merged and released with 3.0.0-alpha.10, so should be part of latest beta/RC.

@wadetandy
Copy link
Contributor

And I have confirmed as it is working for me with those releases. May be a related but separate bug affecting you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants