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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

noproxy config is not respected when running ng update #16615

Closed
1 of 15 tasks
kawazoe opened this issue Jan 9, 2020 · 3 comments 路 Fixed by #17358 or #17359
Closed
1 of 15 tasks

noproxy config is not respected when running ng update #16615

kawazoe opened this issue Jan 9, 2020 · 3 comments 路 Fixed by #17358 or #17359
Labels
area: angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Milestone

Comments

@kawazoe
Copy link

kawazoe commented Jan 9, 2020

馃悶 Bug report

Command

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes. This would not have been a problem prior to angular/devkit#692 assuming a private registry was accessible without proxy. It is also relevant to #13166 .

Description

NPM natively supports a noproxy setting in the .npmrc file that will prevent the proxy settings from being used for some specific URLs. This is incredibly useful when you have a private repository that is within your corporate network, but some packages, like node-sass will still need to reach to the internet to download binary files through the proxy.

Assuming that your private registry is at registry.company.com, you can add either the full sub-domain, or even just company.com to the noproxy setting and NPM will go to the registry directly, but all calls to other URLs done by NPM will still go through the proxy.

When using ng update, all calls using npm-registry-client will go through the proxy, even though they should be blacklisted by the noproxy list. This will cause calls to fail when using an enterprise proxy and a private registry that cannot be reached through the proxy.

馃敩 Minimal Reproduction

  • Setup a private npm repository that forwards calls to the official repository
  • Setup a proxy so that it is required to go through the proxy to reach the broad internet, but that the private npm repository MUST be reached directly.
  • Configure your .npmrc file like so:
proxy: myproxy.company.com
https-proxy: myproxy.company.com
noproxy: company.com
  • Attempt to update an angular project from angular@^6 to angular@^7 using ng update.

馃敟 Exception or Error

At this point, ng update will fail trying to parse the json file that is expected from the registry and print the html error page returned by the proxy instead. Something on the lines of:

Failed to parse JSON at column 1, unexpected token < in :
<doctype HTML........
  Cannot reach <insert package url here>. Timeout.
</html>

馃實 Your Environment


Angular CLI: 7.3.9
Node: 13.2.0
OS: win32 x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.5
@angular-devkit/build-angular     0.8.5
@angular-devkit/build-optimizer   0.8.5
@angular-devkit/build-webpack     0.8.5
@angular-devkit/core              0.8.5
@angular-devkit/schematics        7.3.9
@angular/cli                      7.3.9
@ngtools/webpack                  6.2.5
@schematics/angular               7.3.9
@schematics/update                0.13.9
rxjs                              6.5.4
typescript                        3.2.4
webpack                           4.21.0

Anything else relevant?
Requires a private repository and proxy that cannot reach the repository.

Workaround

Since ng-update will run NPM install scripts after doing the npm-registry-client calls, it is possible to remove the proxy setting before running ng update, and add it back as npm starts the install process using a second console. This will work as long as the first few packages getting installed does not do any network calls in their install script. It is also an incredibly risky workaround and I would recommend anyone attempting this to delete their node_modules folders after the update process, set their proxy settings correctly and re-run npm install before moving on.

@ngbot ngbot bot added this to the needsTriage milestone Jan 13, 2020
@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Jan 13, 2020
@alan-agius4
Copy link
Collaborator

Hi, is this still an issue in Angular CLI 8?

@kawazoe
Copy link
Author

kawazoe commented Jan 16, 2020

I have not tested this with angular/cli 8 yet, but the most recent commit of the update code has no mention of the noproxy config so I would assume the issue is still present. I will try to test this soon and will update this thread once I have a definitive answer.

@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix and removed needs: more info Reporter must clarify the issue labels Mar 30, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Mar 30, 2020
@alan-agius4 alan-agius4 linked a pull request Apr 1, 2020 that will close this issue
kyliau pushed a commit that referenced this issue Apr 2, 2020
kyliau pushed a commit that referenced this issue Apr 2, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: angular/cli freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
2 participants