Skip to content

sfdx cli ignores NO_PROXY environment variable #1798

Closed

Description

@colinhuckstep

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:

  1. Set HTTP_PROXY and HTTPS_PROXY to corporate proxy.
  2. Set NO_PROXY=salesforce.com,force.com
  3. sfdx auth:web:login -r https://org--sandbox.my.salesforce.com
  4. 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
  • If you are using sf
    • Run sf version --verbose --json

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"
}

Additional information

Activity

  1. github-actions commented on Nov 7, 2022

    @github-actions

    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.

  2. added
    featureIssue or pull request for a new feature
    and removed
    investigatingWe're actively investigating this issue
    on Nov 7, 2022
  3. github-actions commented on Nov 7, 2022

    @github-actions

    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.

  4. git2gus commented on Nov 7, 2022

    @git2gus

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

  5. mshanemc commented on Nov 7, 2022

    @mshanemc
    Contributor

    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.

  6. WillieRuemmele commented on Aug 1, 2023

    @WillieRuemmele
    Member

    Check out this discussion, closing as duplicate
    #2375

  7. colinhuckstep commented on Aug 2, 2023

    @colinhuckstep
    Author

    Check out this discussion, closing as duplicate
    #2375

    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.

  8. locked and limited conversation to collaborators on Aug 28, 2024
  9. converted this issue into a discussion #2996 on Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions