[NPMCLI-176] mgnl jumpstart fails when behind proxy Created: 27/Mar/18  Updated: 11/Feb/19  Resolved: 06/Dec/18

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: 3.0.0
Fix Version/s: 3.0.5

Type: Bug Priority: Critical
Reporter: Vyacheslav Mayorov Assignee: Federico Grilli
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

node v9.9.0


Issue Links:
Cloners
is cloned by NPMCLI-207 jumpstart STILL fails when behind proxy Closed
is cloned by NPMCLI-199 mgnl jumpstart fails Closed
relation
is related to NPMCLI-196 Replace axios-https-proxy-fix again w... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:
Sprint: Basel 161
Story Points: 1

 Description   
$ mgnl jumpstart
info Using configuration at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli.json
info Using prototypes at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli-prototypes
? What Magnolia would you like to install? magnolia-community-webapp
info No magnolia-version option provided. Will use the latest stable version.
info No path option provided. Will use the default light-modules in the current directory
info /home/acc15/MyProgs/temp/gregre/light-modules does not seem to exist. Path will be created automatically.
ERR! Cannot read property 'status' of undefined
ERR! TypeError: Cannot read property 'status' of undefined
ERR!     at handleError (/usr/lib/node_modules/@magnolia/cli/lib/download.js:27:20)
ERR!     at axios.get.then.catch (/usr/lib/node_modules/@magnolia/cli/lib/download.js:75:5)
ERR!     at <anonymous>
ERR!     at process._tickCallback (internal/process/next_tick.js:118:7)
ERR!  
ERR!  
ERR! mgnl: 3.0.0 node: v9.9.0 os: linux
ERR! please open an issue including this log on https://jira.magnolia-cms.com/browse/NPMCLI


 Comments   
Comment by Mario Curcija [ 06/Jun/18 ]

Are you behind proxy?

Comment by Vyacheslav Mayorov [ 07/Jun/18 ]

Yes.

$ npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.1.0 node/v10.3.0 linux x64"

; globalconfig /usr/etc/npmrc
https-proxy = "http://localhost:8888/"
proxy = "http://localhost:8888/"

; node bin location = /usr/bin/node
; cwd = /home/acc15
; HOME = /home/acc15
; "npm config ls -l" to show all defaults.
Comment by Vyacheslav Mayorov [ 07/Jun/18 ]

Previous versions works fine behind proxy.

Comment by Mario Curcija [ 07/Jun/18 ]

What is the output of:

env | grep -i proxy ?

I think axios picks up proxy setting from OS environment  and not from npmrc:

https://github.com/axios/axios/blob/master/lib/adapters/http.js (starting at line 97)

Comment by Vyacheslav Mayorov [ 08/Jun/18 ]

It is almost the same (localhost vs 127.0.0.1):

$ env | grep https_proxy
https_proxy=http://127.0.0.1:8888/

After debugging i found an real error:

Error: write EPROTO 140717866489728:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:252:

 at WriteWrap.afterWrite [as oncomplete] (net.js:832:14)

And it looks like an axios issue
https://github.com/axios/axios/issues/925

Comment by Vyacheslav Mayorov [ 08/Jun/18 ]

One solution is to downgrade axios, or wait for fix...

Comment by Vyacheslav Mayorov [ 08/Jun/18 ]

And also there is a problem with `handleError` which is swallowed up real reason.

Comment by Mario Curcija [ 08/Jun/18 ]

If you are really eager to use it, you should try modifying cli's download.js with "axios-https-proxy-fix" as sugessted in: https://github.com/axios/axios/issues/925
It worked for me.

A vote for this issue should be set as well.

Comment by Christopher Zimmermann [ 28/Aug/18 ]

I believe this is a duplicate of https://jira.magnolia-cms.com/browse/NPMCLI-182 and is solved in version 3.0.1 of the CLI.

acc15 It would be great if you can try the new version of the CLI and verify if this solves your issue and leave a comment here.

Closing for now - please re-open if 3.0.1 does not solve your issue.

Comment by Vyacheslav Mayorov [ 31/Aug/18 ]

3.0.3 - same problem

{{mgnl jumpstart }}
{{info Using configuration at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli.json }}
{{info Using prototypes at /usr/lib/node_modules/@magnolia/cli/lib/config/mgnl-cli-prototypes }}
{{? What Magnolia would you like to install? magnolia-community-webapp }}
{{info No magnolia-version option provided. Will use the latest stable version. }}
{{info No path option provided. Will use the default light-modules in the current directory }}
{{info /tmp/fewvjiowmjoi/light-modules does not seem to exist. Path will be created automatically. }}
{{ERR! Cannot read property 'status' of undefined }}
{{ERR! TypeError: Cannot read property 'status' of undefined }}
{{ERR!     at handleError (/usr/lib/node_modules/@magnolia/cli/lib/download.js:27:20) }}
{{ERR!     at axios.get.then.catch (/usr/lib/node_modules/@magnolia/cli/lib/download.js:75:5) }}
{{ERR!     at process._tickCallback (internal/process/next_tick.js:68:7) }}
ERR!  
ERR!  
{{ERR! mgnl: 3.0.3 node: v10.9.0 os: linux }}
ERR! please open an issue including this log on https://jira.magnolia-cms.com/browse/NPMCLI
{{ }}

Comment by Christopher Zimmermann [ 03/Sep/18 ]

Reopening, because it is not a duplicate.

(Solution may be to pin axios dependency at an earlier version - similar as done here: https://jira.magnolia-cms.com/browse/NPMCLI-182) Or to use the "axios-https-proxy-fix" suggested in comments above.

 

Note that axios project has a beta version (0.19.0-beta.1) with a fix for this bug.

https://github.com/axios/axios/issues/925#issuecomment-417480458

 

Comment by mantasink [ 14/Sep/18 ]

Same problem. Any workaround?

Comment by Christopher Zimmermann [ 17/Sep/18 ]

mantasink For workaround see comment from Mario above on 08/Jun/18.

Comment by Georg Abenthung [ 27/Nov/18 ]

Any news on this issue? Workaround seems to be a bit too complicated.

 

Comment by Christopher Zimmermann [ 27/Nov/18 ]

Hi George, thanks for the "bump". 

There's no progress. I think we can do something in December.

 

Comment by Federico Grilli [ 17/Dec/18 ]

acc15 and other interested parties: @magnolia/cli 3.0.5 has been just released and contains a fix for this. https://www.npmjs.com/package/@magnolia/cli

Cheers,

Federico

Comment by Joerg von Frantzius [ 14/Jan/19 ]

I just tried with mgnl: 3.0.5 node: v10.15.0 os: darwin and a local cntlm proxy configured in ~/.npmrc:

https-proxy = "http://localhost:3126/"

proxy = "http://localhost:3126/"

Unfortunately, it seems that the proxy is not properly picked up (it does where everywhere else):

? What Magnolia would you like to install? magnolia-community-demo-webapp

info No magnolia-version option provided. Will use the latest stable version.

info No path option provided. Will use the default light-modules in the current directory

ERR! Request failed with status code 501

ERR! Error: Request failed with status code 501

ERR!     at createError (/Users/joerg.frantzius/.nvm/versions/node/v10.15.0/lib/node_modules/@magnolia/cli/node_modules/axios-proxy-fix/lib/core/createError.js:16:15)

ERR!     at settle (/Users/joerg.frantzius/.nvm/versions/node/v10.15.0/lib/node_modules/@magnolia/cli/node_modules/axios-proxy-fix/lib/core/settle.js:18:12)

ERR!     at IncomingMessage.handleStreamEnd (/Users/joerg.frantzius/.nvm/versions/node/v10.15.0/lib/node_modules/@magnolia/cli/node_modules/axios-proxy-fix/lib/adapters/http.js:194:11)

ERR!     at IncomingMessage.emit (events.js:187:15)

ERR!     at endReadableNT (_stream_readable.js:1094:12)

ERR!     at process._tickCallback (internal/process/next_tick.js:63:19)

Comment by Federico Grilli [ 08/Feb/19 ]

jfrantzius Thanks for reporting this. I've seen this ticket has been cloned by another user with the same problem. We'll try to tackle it asap. At first glance, it could be that the library we use for the fix isn't handling https proxies correctly. Probably it will have to be replaced with https://www.npmjs.com/package/axios-https-proxy-fix as long as axios itself doesn't fix it.

Generated at Mon Feb 12 04:47:15 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.