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

can't use NO_PROXY env var if proxy is configured via .yarnrc #710

Closed
cristiand391 opened this issue Nov 9, 2023 · 1 comment · Fixed by #776
Closed

can't use NO_PROXY env var if proxy is configured via .yarnrc #710

cristiand391 opened this issue Nov 9, 2023 · 1 comment · Fixed by #776
Labels
bug Something is not working

Comments

@cristiand391
Copy link
Member

cristiand391 commented Nov 9, 2023

Describe the bug
can't use NO_PROXY env var when installing plugins if I set up proxy via yarn config.

plugin-plugins doesn't pass --no-default-rc flag to yarn when installing plugins so it will pick what's on ~/.yarnrc.
If I set the proxy address via yarn config set, then I can't use NO_PROXY due to a yarn v1 bug:
yarnpkg/yarn#5048

To Reproduce
Steps to reproduce the behavior:

  1. Set https proxy (don't need to setup a local proxy, can point to localhost): yarn config set https-proxy "localhost:8888"
  2. try installing a plugin but set NO_PROXY='registry.yarnpkg.com' so that it can reach the yarn registry

Expected behavior
NO_PROXY is respected.

Idea

plugin-plugins could pass --use-yarnrc to save a custom yarn config file that is savesd in the CLI data dir, that way users can still use the global yarn config file without being affected by CLI internals.
Also it should set --no-default-rc so that no global npmrc/yarnrc file is read.

Also tried using npm_config env vars to pass proxy settings and passing --no-default-rc to yarn but it didn't work.

Workarounds

  1. only set proxy via env vars, no yarn/npm config.
  2. follow this workaround: Yarn ignores no_proxy environment variable when proxy property set yarnpkg/yarn#5048 (comment)

Screenshots

1. no yarn/npm config vars, proxy env vars work fine:

Screenshot 2023-11-09 at 12 28 05

NOTE: see second run with the typo in NO_PROXY env var, that shows HTTPS_PROXY is respected.

2. proxy set in .yarnrc file, install of plugin-org fails when using NO_PROXY (can't reach registry)

Screenshot 2023-11-09 at 12 05 29

NOTE: in the screenshot I used the local sf CLI and removed plugin-trust to remove the preinstall hook (it does a request that fails b/c localhost:8888 doesn't exist).

3. with suggested workaround

Screenshot 2023-11-09 at 12 10 42

Environment (please complete the following information):

  • OS & version: macos sonoma
  • Shell/terminal & version zsh/alacritty

Additional context
Reported in Salesforce CLI repo:
forcedotcom/cli#2540

Copy link

git2gus bot commented Nov 9, 2023

This issue has been linked to a new work item: W-14462904

@cristiand391 cristiand391 changed the title can't use NO_PROXY env var proxy is configured via .yarnrc can't use NO_PROXY env var if proxy is configured via .yarnrc Nov 9, 2023
@mdonnalley mdonnalley added bug Something is not working and removed bug labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants