force:source:deploy returns getaddrinfo ENOTFOUND for scratch orgs but but sandboxes.

Issue #2109 resolved
Greg Shaw created an issue

I am behind a fairly thorough corporate firewall that really does my head some days. I’ve resolved most of the issues but IntelliJ and IC2 still aren’t working. I’m look for some advice.

I use alpaca running on port 3128 on Macbook and http_Proxy values to redirect traffic to the corporate VPN. This enables sfdx to run on the command line. In IC2 it is a different story. This issue only affects scratch orgs and I suspect that is related to the use of production (SSO access only) as the DevHub.

I have IntelliJ configured to use manual proxy and point it at localhost:3128. In theory IC2 should have the same experience and a terminal shell.
Using #com.illuminatedcloud.util.CommandLineUtil I can see the sfdx command that is used for deploy. If I run that exact same command in a shell (using the proxy and VPN) it works. If I run it in IC2 I get:
CommandLineResponse{exitCode=1, output='{ "status": 1, "name": "Error", "message": "getaddrinfo ENOTFOUND butterpecan-tahoe-1518.cs115.my.salesforce.com", "exitCode": 1, "commandName": "Deploy", "stack": "Error: getaddrinfo ENOTFOUND butterpecan-tahoe-1518.cs115.my.salesforce.com\n at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26)\nOuter stack:\n at Function.wrap (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n at Deploy.catch (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:248:67)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Deploy._run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n at async Config.runCommand (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n at async SfdxMain.run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n at async SfdxMain._run (/opt/homebrew/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/opt/homebrew/lib/node_modules/sfdx-cli/dist/cli.js:162:47)", "warnings": []}', error='Error: getaddrinfo ENOTFOUND butterpecan-tahoe-1518.cs115.my.salesforce.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'butterpecan-tahoe-1518.cs115.my.salesforce.com'}Error: getaddrinfo ENOTFOUND anz.my.salesforce.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:72:26) { errno: -3008, code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'anz.my.salesforce.com'}', duration=2010}

I’m not expecting you to debug my VPN or proxy configuration. I’m just looking for some way to determine why the IC2 experience and use of the proxy is so different to using the shell. Is there another debug setting I can use to see what environment settings or proxy settings it is actually using as opposed to what is configured.

Thanks, Greg.

Comments (6)

  1. Scott Wells repo owner

    Hi. IC2 executes the Salesforce CLI using the same environment as the IDE process itself, so if you've configured environment variables and such in your shell that are not also available to the IDE process, that would explain the difference in behavior. You can see exactly how the CLI is executed by enabling Illuminated Cloud > Configure Application > Salesforce DX > Log Salesforce CLI commands in which every CLI execution performed by IC2 will be output to a tab in the IDE's Messages tool window including the exact CLI that was executed, the working directory, the environment variables passed on to the CLI, etc. My guess is that you need to make sure that the JetBrains IDE is running with the same configuration as your shell and things will work properly.

  2. Scott Wells repo owner

    Resolving assuming that it's an issue with the host IDE's environment not matching the command-line environment. Feel free to reopen if you find that they are identical and the problem still occurs.

  3. Greg Shaw reporter

    Happy to resolve this one. Thanks for your help. Issue still exists but now I have more information to work out what is going on.

  4. Greg Shaw reporter

    Update:
    I fixed this one by launching IntelliJ on the command line:

    open -a /Applications/IntelliJ\ IDEA\ CE.app

    This causes the proxy variables in the Terminal environment to be used by sfdx. If I launch IntelliJ from the dock the issue returns.

  5. Scott Wells repo owner

    Greg, how are these environment variables getting set? I've found that on the Mac, setting environment variables in .zshrc (assuming you use zsh as your user's default shell) causes them to get picked up by apps executed via the dock. I'm not a Mac guy, though, so if that doesn't work you might need to check on how to set environment variables so that dock-launched apps can see them.

  6. Greg Shaw reporter

    Proxy environment variables are set in .zshrc with export command. I too had assumed that environment variables would be imported into a Dock app. That appears to not be the case. open -a works.

  7. Log in to comment