Repository navigation
sfdx cli ignores NO_PROXY environment variable #1798
Description
Summary
I am behind a corporate proxy and as such have my HTTP_PROXY and HTTPS_PROXY environment variables set. We have Salesforce addresses bypassed in the proxy due to IP restrictions, so I have set NO_PROXY=salesforce.com,force.com however sfdx cli appears to be ignoring NO_PROXY as I receive an IP Restricted error when logging in. I don't want to have to unset HTTP_PROXY and HTTPS_PROXY every time I need to use sfdx cli as all of my other tools require the proxy settings.
Steps To Reproduce:
- Set HTTP_PROXY and HTTPS_PROXY to corporate proxy.
- Set NO_PROXY=salesforce.com,force.com
- sfdx auth:web:login -r https://org--sandbox.my.salesforce.com
- Login to the Sandbox in opened browser page
Expected result
Successfully authorized xxxxxx@xxxxx.com with org ID xxxxxxxxxxxxxxxx
Actual result
{ "status": 1, "name": "SfError", "message": "Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: ip restricted", "exitCode": 1, "context": "Login", "stack": "SfError: Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: ip restricted\n at Login.run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@salesforce/plugin-auth/lib/commands/auth/web/login.js:51:23)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Login._run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:102:40)\n at async Config.runCommand (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/config/config.js:272:25)\n at async run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@oclif/core/lib/main.js:76:5)", "warnings": [], "commandName": "Login" }
System Information
- Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)
zsh - If you are using
sfdx- Run
sfdx version --verbose --json
- Run
- If you are using
sf- Run
sf version --verbose --json
- Run
sfdx version --verbose --json
{
"cliVersion": "sfdx-cli/7.170.0",
"architecture": "darwin-arm64",
"nodeVersion": "node-v16.18.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 1.3.0 (core)",
"@oclif/plugin-commands 2.2.0 (core)",
"@oclif/plugin-help 5.1.12 (core)",
"@oclif/plugin-not-found 2.3.1 (core)",
"@oclif/plugin-plugins 2.1.0 (core)",
"@oclif/plugin-update 3.0.0 (core)",
"@oclif/plugin-version 1.1.2 (core)",
"@oclif/plugin-warn-if-update-available 2.0.4 (core)",
"@oclif/plugin-which 2.1.0 (core)",
"alias 2.1.0 (core)",
"apex 1.2.0 (core)",
"auth 2.2.8 (core)",
"community 2.0.1 (core)",
"config 1.4.20 (core)",
"custom-metadata 2.0.0 (core)",
"data 2.1.2 (core)",
"generator 2.0.2 (core)",
"info 2.1.3 (core)",
"limits 2.0.1 (core)",
"org 2.2.3 (core)",
"packaging 1.9.1 (core)",
"schema 2.1.6 (core)",
"signups 1.2.2 (core)",
"source 2.0.15 (core)",
"telemetry 2.0.0 (core)",
"templates 55.1.0 (core)",
"trust 2.0.4 (core)",
"user 2.1.4 (core)",
"@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
"salesforce-alm 54.8.1 (core)",
"sfpowerkit 6.0.0 (user)"
],
"osVersion": "Darwin 22.1.0",
"shell": "zsh",
"rootPath": "/opt/homebrew/lib/node_modules/sfdx-cli"
}
Activity
github-actions commentedon Nov 7, 2022
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.
github-actions commentedon Nov 7, 2022
Thank you for filing this feature request. We appreciate your feedback and will review the feature at our next grooming or sprint planning session. We prioritize feature requests with more upvotes and comments.
git2gus commentedon Nov 7, 2022
This issue has been linked to a new work item: W-12024455
mshanemc commentedon Nov 7, 2022
Yeah, jsforce has no support for NO_PROXY, so we've inherited that lack of support.
If you'd like to move it along sooner, I'd recommend trying some changes to https://github.com/jsforce/jsforce/blob/2.0/src/transport.ts and sending a PR.
WillieRuemmele commentedon Aug 1, 2023
Check out this discussion, closing as duplicate
#2375
colinhuckstep commentedon Aug 2, 2023
Disagree with this being a duplicate. That thread is asking for an inline way to specify the proxy. I'm asking for the NO_PROXY env var to be supported. Very different things.