forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
953 stars 405 forks source link

"SFDX: Authorize an Org" fails with "CLI Command process failed to start" #5800

Open m-lp-ql-m opened 3 months ago

m-lp-ql-m commented 3 months ago

Summary

Running "SFDX: Authorize an Org" in VS Code via CTL+SHIFT+P results in a popup saying "Command 'SFDX: Authorize an Org' resulted in an error CLI Command process failed to start"

No problems listed in the PROBLEMS tab.

I AM able to authorize via the terminal with sfdx auth:web:login --alias UAT --instance-url https://test.salesforce.com --set-default

Fresh install. I've tried completely purging extensions, VS Code, @salesforce/cli, and nodejs, and reinstalling whole shebang; no change.

Steps To Reproduce:

  1. In VS Code, CTL+SHIFT+P to bring up command box
  2. Select SFDX: Authorize an Org
  3. Use Sandbox login: test.salesforce.com
  4. Enter alias (I'm using "UAT")

Expected result

Salesforce login usually opens in Chrome browser

Actual result

Error pop up

Additional information

Salesforce Extension Version in VS Code: 61.11.0 Salesforce CLI Version: 2.56.7 OS and version: Kubuntu 24.04.1 VS Code version: 1.92.2 Most recent version of the extensions where this was working: possibly 61.8.1: most recent extension version works OK on my work Windows 11 computer. Did a clean reinstall of the entire OS and all programs on my home Linux computer and don't recall which version of the extension I had installed before.

CLI Version: @salesforce/cli/2.56.7 published 3 days ago (Mon Aug 26 2024)

Architecture: linux-x64

Node Version: node-v20.17.0

Plugin Version: @oclif/plugin-autocomplete 3.2.0 (core) @oclif/plugin-commands 4.0.11 (core) @oclif/plugin-help 6.2.8 (core) @oclif/plugin-not-found 3.2.16 (core) @oclif/plugin-plugins 5.4.4 (core) @oclif/plugin-search 1.2.5 (core) @oclif/plugin-update 4.5.3 (core) @oclif/plugin-version 2.2.10 (core) @oclif/plugin-warn-if-update-available 3.1.11 (core) @oclif/plugin-which 3.2.10 (core) @salesforce/cli 2.56.7 (core) apex 3.4.2 (core) api 1.1.0 (core) auth 3.6.48 (core) data 3.6.1 (core) deploy-retrieve 3.10.1 (core) info 3.3.29 (core) limits 3.3.25 (core) marketplace 1.2.22 (core) org 4.5.4 (core) packaging 2.8.0 (core) schema 3.3.24 (core) settings 2.3.13 (core) sobject 1.4.29 (core) source 3.5.14 (core) telemetry 3.6.7 (core) templates 56.3.12 (core) trust 3.7.23 (core) user 3.5.25 (core)

OS and Version: Linux 6.8.0-41-lowlatency

Shell: bash

Root Path: /home/mark/.nvm/versions/node/v20.17.0/lib/node_modules/@salesforce/cli

svc-idee-bot commented 3 months ago

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.

svc-idee-bot commented 3 months ago

Hello @m-lp-ql-m :wave: It looks like you didn't provide all the required basic info in your issue.

If you haven't already, please provide the following info: Salesforce Extension Version in VS Code: Salesforce CLI Version: OS and version: VS Code version: Most recent version of the extensions where this was working:

Here's an example of a set of required info that will pass the validation: Salesforce Extension Version in VS Code: 60.13.0 Salesforce CLI Version: @salesforce/cli/2.42.6 darwin-arm64 node-v18.18.2 OS and version: MacOS Sonoma 14.5 VS Code version: 1.89.1 Most recent version of the extensions where this was working: 60.11.0

A few more things to check:

Thank you!

daphne-sfdc commented 2 months ago

I have seen this issue before. This is the workaround I used:

  1. In the Terminal, go to .vscode/extensions from the home directory and run rm -rf salesforce*.
  2. Quit and restart VSCode.
  3. Reinstall the Salesforce Extension Pack.

I was wondering, how often is this happening on your machine? Is this your first time seeing the issue? (If it's a frequent issue, we would like to collect more data from you to understand what's going on.)

m-lp-ql-m commented 2 months ago

Thanks @daphne-sfdc , but that didn't work. Same issue still.

daphne-sfdc commented 2 months ago

@m-lp-ql-m Sorry to hear that didn't work. I want to confirm that you quit the VSCode application and restarted it rather than just reloading the VSCode workspace. In the context of this issue, the two actions are not the same - reloading does not make the issue go away.

m-lp-ql-m commented 2 months ago

@daphne-sfdc I did quit and restart the whole app, yes.

daphne-sfdc commented 2 months ago

@m-lp-ql-m Here are two other workarounds that we have previously suggested to customers:

  1. Restart your computer. (Given that authorizing an org works using the CLI, this is not a port issue, but still worth trying.)
  2. In your Salesforce project, delete the .sfdx and .sf folders, reload the VSCode workspace, and then try to reauthorize to your org.

Let me know if either of these resolves your issue!

m-lp-ql-m commented 2 months ago

@daphne-sfdc Yea, no, those didn't work either. Rebooted after even.

BTW, an update to VS Code came through (1.92.2 -> 1.93.0) this morning, but that hasn't helped. BTW, also, I run 'npm install @salesforce/cli -g' every morning.

MarcTCruz commented 2 months ago

Same error on Debian 12 using the command option "SFDX: Authorize an Org", I can authorize through terminal.

daphne-sfdc commented 2 months ago

Hi @m-lp-ql-m and @MarcTCruz, What other extensions are you currently running on your VSCode? Can you run "Developer: Show Running Extensions" and send us a screenshot of what you have installed? We want to make sure you don't have another extension installed that conflicts with the Salesforce extensions.

m-lp-ql-m commented 2 months ago

Screenshot_20240906_144349 Screenshot_20240906_144437

There's another extension I'm running that I'm not sure is supposed to be showing up here: "Salesforce Package.xml Generator Extension for VS Code"--this extension itself has an issue. I've uninstalled it, but am still unable to authorize.

MarcTCruz commented 2 months ago

@daphne-sfdc image image image

daphne-sfdc commented 2 months ago

Hi @m-lp-ql-m and @MarcTCruz,

Your running extensions look fine, nothing unusual. We're wondering if this is the case of a mismatch of CLI version between the computer Terminal and the VSCode Terminal. We'd like to verify a few more things - in your VSCode Terminal, run the following and provide the results to us:

  1. which sfdx
  2. which sf
  3. sfdx --version
  4. sf --version
m-lp-ql-m commented 2 months ago
mark@mark-ga790fxtaud5:~/workCode/VSCodeProjects/UAT$ which sfdx
/home/mark/.nvm/versions/node/v20.17.0/bin/sfdx
mark@mark-ga790fxtaud5:~/workCode/VSCodeProjects/UAT$ which sf
/home/mark/.nvm/versions/node/v20.17.0/bin/sf
mark@mark-ga790fxtaud5:~/workCode/VSCodeProjects/UAT$ sfdx --version
@salesforce/cli/2.57.7 linux-x64 node-v20.17.0
mark@mark-ga790fxtaud5:~/workCode/VSCodeProjects/UAT$ sf --version
@salesforce/cli/2.57.7 linux-x64 node-v20.17.0
daphne-sfdc commented 2 months ago

@m-lp-ql-m The info you provided looks correct. We're still attempting to reproduce your issue and will let you know when we have any new steps we would like you to try. Thank you for your patience, and sorry for the inconvenience.

MarcTCruz commented 2 months ago

@daphne-sfdc

me@me:~$ which sfdx
/home/me/.nvm/versions/node/v20.17.0/bin/sfdx
me@me:~$ which sf
/home/me/.nvm/versions/node/v20.17.0/bin/sf
me@me:~$ sfdx --version
s@salesforce/cli/2.57.7 linux-x64 node-v20.17.0
fme@me:~$ sf --version
@salesforce/cli/2.57.7 linux-x64 node-v20.17.0
me@me:~$ 

I have also tried it with this script, it gives the same problem when running the Authorize command through VSCode:

#!/bin/bash
set -e
# Download the Salesforce CLI tarball
curl -L -o sf-linux-x64.tar.gz https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.gz

# Extract files to "sf_files"
mkdir -p sf_files
tar -xzf sf-linux-x64.tar.gz -C sf_files --strip-components=1

# Move sf_files to user path
mkdir -p $HOME/.local/bin
rm -rf $HOME/.local/bin/sf_files
mv sf_files $HOME/.local/bin/sf_files

# Create symlinks from sf and sfdx inside sf_files/bin and move them to user path
ln -sf $HOME/.local/bin/sf_files/bin/sf $HOME/.local/bin/sf
ln -sf $HOME/.local/bin/sf_files/bin/sfdx $HOME/.local/bin/sfdx

# Clean up the downloaded tarball
rm sf-linux-x64.tar.gz

# Line to be added to ~/.bashrc
line='export PATH="$PATH:$HOME/.local/bin"'

# Check if the line exists in ~/.bashrc
if ! grep -Fxq "$line" ~/.bashrc
then
    # If the line does not exist, append it to ~/.bashrc
    echo "$line" >> ~/.bashrc
    echo 'export PATH="$PATH:$HOME/.local/bin" has been added to ~/.bashrc'
else
    echo "Line already exists in ~/.bashrc"
fi
export PATH="$PATH:$HOME/.local/bin"
daphne-sfdc commented 2 months ago

@MarcTCruz From the script, it looks like you’re installing the CLI from the installer, right? But your response to which sf looks like you also have it installed using npm…

Can you try uninstalling the CLI from both npm and the installer then reinstalling it using one of those methods? Here are instructions to uninstall Salesforce CLI: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm

MarcTCruz commented 2 months ago

@MarcTCruz From the script, it looks like you’re installing the CLI from the installer, right? But your response to which sf looks like you also have it installed using npm…

Can you try uninstalling the CLI from both npm and the installer then reinstalling it using one of those methods? Here are instructions to uninstall Salesforce CLI: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm

@daphne-sfdc , hey!

I mean I did it both ways, one at a time without the other, when I tried the script my system hadn't the npm and vice versa, on both ways the "SFDX: Authorize an Org" command failed.

Btw, it probably has something to do to the way it is implemented in VSCode, since using the command line directly works, also it happens on Linux by what is seem, I think you know that, reinforcing, that is where I'd start to dig up.

daphne-sfdc commented 2 months ago

@MarcTCruz FWIW, I have gotten the same issue on my Mac, and I was able to resolve it using the methods that I provided earlier in this thread. My team and I are also suspecting that it might be a Linux-specific issue, although our Linux VM was able to authorize an org without errors.

We're still actively investigating this issue and will keep you updated with what we find. Sorry for the inconvenience, and thank you for working with us.

GeofftheDeov commented 2 weeks ago

Just wanted to hop in and mention I'm experiencing the same issue. I'm on Fedora, and I also installed the Salesforce cli with npm and again with the salesforce extension pack for vscode. If I attempt to authorize an org using the extension, I get the same error, but if I use a terminal, I can authorize just fine. Is there maybe a way to manually point the extension towards the version installed by npm?

mingxuanzhangsfdx commented 2 weeks ago

@GeofftheDeov could you try to launch VSCode using mac's terminal with code .? Before launching VSCode, run which sf and make sure you see the path of sf in the terminal.

MarcTCruz commented 1 week ago

... although our Linux VM was able to authorize an org without errors...

Through CLI? Which Linux is that?

I've just set up a a fresh Debian 12 on a VM, installed VSCode, Java and the extension, same error.