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

Makes fails behind proxy #6

Closed
Aniel opened this issue Mar 13, 2020 · 16 comments · Fixed by #7
Closed

Makes fails behind proxy #6

Aniel opened this issue Mar 13, 2020 · 16 comments · Fixed by #7
Labels
bug Something isn't working

Comments

@Aniel
Copy link

Aniel commented Mar 13, 2020

Hello,

npx makes aurelia fails behind our company proxy on windows.
I added proxy configuration to npm and git

Cloning the aurelia/new repository directly via https works.

❯ npx makes aurelia
npx: installed 1 in 1.983s
makes v1.0.0 https://makes.js.org
[makes] Using remote skeleton github:aurelia/new
[makes] connect ETIMEDOUT 140.82.113.10:443
[makes] Maybe this is a private skeleton.
[makes] Preparing skeleton: git clone git@github.com:aurelia/new.git github.com-aurelia-new
Cloning into 'github.com-aurelia-new'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error: git exit code: 128
    at ChildProcess.r.on (C:\Users\aniel\AppData\Roaming\npm-cache\_npx\25988\node_modules\makes\dist\index.js:25:102892)
    at ChildProcess.emit (events.js:197:13)
    at ChildProcess.e.emit (C:\Users\aniel\AppData\Roaming\npm-cache\_npx\25988\node_modules\makes\dist\index.js:25:102228)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
@3cp 3cp added the bug Something isn't working label Mar 13, 2020
@3cp
Copy link
Member

3cp commented Mar 13, 2020

Investigating.

It seems nodejs api https.request does not check those proxy setting, it has some kind of option to set a proxy explicitly.

I would need to find a way to pass npmrc proxy to the https request.

@Aniel
Copy link
Author

Aniel commented Mar 13, 2020

Another solution could be a proxy argument, like npx makes aurelia --proxy <proxy>.

With the documentation in place and a little hint on network errors Are you behind a proxy? Use --proxy this could be sufficient.

@3cp
Copy link
Member

3cp commented Mar 13, 2020

When you are back to office, please help to do following two tests. Take your time.

Note this runs against makes github code, it will take quite long (1 or 2 mins) for npx to run on-the-fly npm install; npm prepare scripts.

npx makesjs/makes#test1 aurelia

The test1 tag added git clone https://... after git clone git@... failed, this should reuse your git proxy to clone aurelia/new as a "private repo". Let me know if this works.

npx makesjs/makes#test2 aurelia

The test2 tag added support of npmrc config https-proxy or proxy, plus OS env HTTPS_PROXY, HTTP_PROXY and their lower case version.
This should reuse your npm proxy, and should bring the download to normal github tarball download (instead of git clone). Let me know if this works too.

My implementation only supports http(s) proxy for now, no socket proxy. If you want to review the code, it's on branch "proxy".

@Aniel
Copy link
Author

Aniel commented Mar 13, 2020

I will test this first thing on Monday when I am back at the office ;)

@3cp
Copy link
Member

3cp commented Mar 13, 2020

Please also test npx makesjs/makes#test3 aurelia.

It changed api call to support old nodejs v8. Hopefully didn't break test2.

@Aniel
Copy link
Author

Aniel commented Mar 18, 2020

Hey @3cp,
I tried multiple times to run your test but always got the following error. I tried #test1, #test2 and #test3 the errors were identical.

> npm config set proxy http://172.16.110.101:8080
> git config --global http.proxy "http://172.16.110.101:8080"

> npx makesjs/makes#test1 aurelia
  npm ERR! Error while executing:
  npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/makesjs/makes.git
  npm ERR!
  npm ERR! undefined
  npm ERR! exited with error code: 128

  npm ERR! A complete log of this run can be found in:
  npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-03-17T10_50_22_872Z-debug.log
  Install for github:makesjs/makes#test1 failed with code 1

2020-03-17T10_50_22_872Z-debug.log

Also when running git clone https://github.com/makesjs/makes.git the repo gets cloned correctly.

@3cp
Copy link
Member

3cp commented Mar 18, 2020

looks like npx with git repo doesn't support npmrc proxy,
because npx tried to fetch the git repo using ssh protocol, not https protocol,

npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/makesjs/makes.git

I will provide you three npm pre-release versions to try out.

@3cp
Copy link
Member

3cp commented Mar 18, 2020

Ok

npx makes@1.1.0-test1 aurelia
npx makes@1.1.0-test2 aurelia
npx makes@1.1.0-test3 aurelia

@Aniel
Copy link
Author

Aniel commented Mar 18, 2020

Okay, after testing all 3 variants I can report the following:

  • All 3 testes cloned and created the project successfully
  • In test 1 and 3 the command output while selecting the options was "a little bit" off (See screenshot Test 1 and 3)
  • Test 2 was subjectively the fastest

Test 1

image

Test 2

image

Test 3

image

Additonal Enviroment Information

I am using Powershell Core with the Windows Termial Preview

Windows Terminal (Preview)
Version: 0.9.433.0
---
PSVersion                      7.0.0
PSEdition                      Core
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@3cp
Copy link
Member

3cp commented Mar 18, 2020

Thx. The results of test1 and test2 are expected.
The failure of tarball download in test3 is unexpected, it failed back to git clone https same as test1. I will double check.

@3cp
Copy link
Member

3cp commented Mar 18, 2020

The color escape keys all messed up in test1 and test3, I am not sure is it windows terminal issue or my issue.

@3cp
Copy link
Member

3cp commented Mar 18, 2020

Ok, test4 should restored the behavior to be same as test2.

npx makes@1.1.0-test4 aurelia

For the color escape keys issue, I cannot reproduce in my terminal, I assume is kind of windows terminal issue.

@Aniel
Copy link
Author

Aniel commented Mar 19, 2020

Test 4 works and even the colors are correct ;)

image

@3cp
Copy link
Member

3cp commented Mar 19, 2020

Great. In test1 and test3, the color issue is probably caused by the ssh error message printed by failed git clone git@...

Those ssh error message is not controlled by me.

@3cp 3cp closed this as completed in da5b712 Mar 19, 2020
@3cp 3cp closed this as completed in #7 Mar 19, 2020
@3cp
Copy link
Member

3cp commented Mar 19, 2020

Released.

@Aniel
Copy link
Author

Aniel commented Mar 19, 2020

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants