-
Notifications
You must be signed in to change notification settings - Fork 78
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
Plugin installation doesn't appear to respect proxies #2540
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
Hey @kyle-blair I'been testing this with a local proxy server and see the requests go through the proxy with the
are you able to check the proxy logs to verify there was a connection? |
Apologies, I didn't provide the full picture for the sake of simplicity but those details may be relevant. We use a private package registry as well and that traffic should not go through the proxy. I have additional proxy variables set, including NO_PROXY/no_proxy. I can see the internal registry is being picked up correctly (presumably from npm config), however it throws a 502 gateway error. Relevant dev debug output below. It seems like it's not picking up the no proxy variables, sending traffic to our internal registry through the proxy, and therefore the proxy returns 502. I'll try to check with our network team to see if something is going on on our side. I've always had issues installing sf/sfdx plugins even before this just in time behavior, but in those cases I'd see a 407 error. @oclif/plugins installing plugin @salesforce/plugin-packaging +0ms
cli:yarn /Users/user/.local/share/sf: /Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli/node_modules/yarn/bin/yarn.js add @salesforce/[email protected] --non-intInstalling plugin [email protected]... ⡿ info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://private.registry.com/@salesforce%2fplugin-packaging: tunneling socket could not be established, statusCode=502".
cli:yarn yarn error Error: /Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli/node_modules/yarn/bin/yarn.js add @salesforce/[email protected] --non-interactive --mutex=file:/Users/user/.local/share/sf/yarn.lock --preferred-cache-folder=/Users/user/Library/Caches/sf/yarn --check-files --registry=https://private.registry.com/ exited with code 1
at ChildProcess.<anonymous> (/Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli/node_modules/@oclif/plugin-plugins/lib/yarn.js:32:28)
at ChildProcess.emit (node:events:514:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) +3m
@oclif/plugins error installing plugin: Error: /Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli/node_modules/yarn/bin/yarn.js add @salesforce/[email protected] --non-interactive --mutex=file:/Users/user/.local/share/sf/yarn.lock --preferred-cache-folder=/Users/user/Library/Caches/sf/yarn --check-files --registry=https://private.registry.com/ exited with code 1
at ChildProcess.<anonymous> (/Users/user/.nvm/versions/node/v18.17.1/lib/node_modules/@salesforce/cli/node_modules/@oclif/plugin-plugins/lib/yarn.js:32:28)
at ChildProcess.emit (node:events:514:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12) +3m |
@kyle-blair looks like this is a know issue (and yarn v1 is in maintenance mode so we don't expect it to be fixed) but someone found a workaround using npm/yarn config files: |
Initial testing of that workaround does not resolve the issue. I was hopeful since there were a few differences with how my proxy has been configured (for years): I didn't have a PROXY environment variable, and I use some variations of the specified config keys for the npm settings. I'll try a few more things, however, given that issue is 6 years old and the workaround is 3 years old, I think there are too many unknowns or things that could have changed in that time. I assume a lot of Salesforce's customers use corporate proxies and (maybe less so) internal package registries. I'm surprised this wasn't a factor in the decision to use just in time plugins, let alone tested. It's another item in the long list of painful experiences with the cli. When was just in time plugin installation introduced? My best bet at this point may be to go back to that version for a while. |
I did a "clean slate" attempt at the workaround, and the just in time plugin install worked this time. Here's what I did:
The kicker is, after the plugin was installed, the command failed because the proxy wasn't configured correctly. So, this is all a one-time manual setup needed to install just in time plugins and then you need to revert back to your typical proxy configuration to use the cli normally. I wouldn't consider that a viable solution, and it negates any advantages to just in time plugin installation. |
So, what is the plan here? This is a significant issue for anyone behind a corporate proxy with a private npm registry and the workaround is not reasonable. |
@kyle-blair so you got an error when running the packaging command? Can you share the exact error? |
As explained in my last comment, the workaround you shared doesn't work when done in addition to the typical, required proxy variables. I had to start with no variables set and then set only the variables mentioned in the workaround to be able to install the plugin. That configuration is not valid for everyday proxy use. Therefore, I have to follow those exact steps in order to install (and presumably update) plugins, and then revert back to my typical configuration. The original issue still stands. Just in time plugin installation does not work with a corporate proxy and private npm registry. The workaround is just that--a workaround--not a viable solution. As far as I'm concerned, just in time plugin installation is not worth the trouble. I'm not sure what problems it was intended to address, but I'd just as soon turn it off if I could. |
Facing this in a corporate environment too and it's making it impossible to use. |
@cristiand391 |
This is a big issue for us as well. |
Potential Workaround: Downgrade to 2.3.8 (or a version close to) using https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm#sfdx_setup_install_cli_olderversions and after running |
I got this error as well. The solution described on this thread worked for me:
I had to run that into a bash terminal
The odd part is that if I run that on terminal, I get the error below:
That worked for me, In my case I was generating a new package version. VERSION |
Longer-term, we're going to come up with a solid solution for this in oclif. But there's some complexity there. In the short-term, we've converted plugin-packaging from JIT to bundled, which should help unblock the majority of people who have posted here. It won't solve the installation of plugins from private registries from behind proxies use case (that'll be the longer term fix). |
This actually now resolves my issue of not being able to install the packaging plugin (that is required for sf package install command) due to using an internal company NPM registry rather than the public/external NPM registry, thanks for the fix. I believe that now the plugin is being installed within the SF CLI package, it's no longer failing upon package installs. Note: I did have to specify the CLI version to use rc since it's not officially released yet but will be soon! '2.19.7 (Nov 29, 2023) [stable-rc]' |
This issue has been linked to a new work item: W-14581559 |
in bash also i am getting the same error |
All I've got is an update on this. The plugin installation is part of the oclif framework. (oclif/plugin-plugins) is a PR to switch from using yarn1 to using current npm for managing all the installed plugins. It's obviously not trivial to change and test, and there'll probably be some required steps (yarnrc vs. npmrc, maybe some envs) But the good news is that current npm should respect all your proxy stuff better than the old yarn does. |
@kyle-blair Have you seen this announcement? We're switching to You can access it via the |
I am on leave for a while, but let me pass this along to a colleague. |
Summary
The sf cli cannot get through a proxy to install plugins.
Steps To Reproduce
No repo is necessary. You must be behind a restrictive web proxy to reproduce this issue. I use nvm, but I don't think that's part of the issue.
npm install --global @salesforce/cli
.sf package installed list --target-org yourTargetOrgAlias
Expected result
The required plugin is installed successfully and the command runs.
Actual result
System Information
Additional information
I spent a while trying to figure out if I could get this to work somehow, with no luck. Many sources indicated it should "just work", such as yarn inheriting proxy configuration from npm. I was unable to set yarn configuration directly due to unrelated issues with corepack, so I'm out of things to try at this point.
The text was updated successfully, but these errors were encountered: