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

Salesforce extensions not loading / stuck #5929

Closed jasonmatos closed 3 weeks ago

jasonmatos commented 1 month ago

Summary

Salesforce extensions fail to load/activate when opening existing project

Steps To Reproduce:

  1. Launch Visual Studio Code (User install) v1.92.2
  2. Select File > Open Folder...
  3. Search existing SFDX project
  4. Locate manifest file package.xml
  5. Right click

Expected result

See the SFDX: Deploy source in Manifest to Org and SFDX: Retrieve Source in Manifest from Org

Actual result

The menu option are not available.

Additional information

Salesforce Extension Version in VS Code: 62.2.0 Salesforce CLI Version: 2.62.8 OS and version: Windows 10 Entreprise 22H2 VS Code version: 1.92.2

"Developer: Show Running Extensions" image

"Developer: Startup Performance" Startup Performance.txt

jasonmatos commented 1 month ago

sf version --verbose CLI Version: @salesforce/cli/2.62.6 published 21 days ago (Tue Oct 08 2024) (latest is 2.63.9)

Architecture: win32-x64

Node Version: node-v20.9.0

Plugin Version: @oclif/plugin-autocomplete 3.2.5 (core) @oclif/plugin-commands 4.1.3 (core) @oclif/plugin-help 6.2.14 (core) @oclif/plugin-not-found 3.2.22 (core) @oclif/plugin-plugins 5.4.14 (core) @oclif/plugin-search 1.2.11 (core) @oclif/plugin-update 4.6.3 (core) @oclif/plugin-version 2.2.14 (core) @oclif/plugin-warn-if-update-available 3.1.18 (core) @oclif/plugin-which 3.2.15 (core) @salesforce/cli 2.62.6 (core) apex 3.5.1 (core) api 1.3.1 (core) auth 3.6.65 (core) data 3.7.0 (core) deploy-retrieve 3.12.17 (core) info 3.4.9 (core) limits 3.3.32 (core) marketplace 1.2.26 (core) org 4.6.0 (core) packaging 2.8.11 (core) schema 3.3.34 (core) settings 2.3.23 (core) sobject 1.4.41 (core) source 3.5.21 (core) telemetry 3.6.15 (core) templates 56.3.22 (core) trust 3.7.33 (core) user 3.5.32 (core)

OS and Version: Windows_NT 10.0.19045

Shell: C:\Program Files\Git\usr\bin\bash.exe

Root Path: C:\Users[myUser]\AppData\Roaming\npm\node_modules\@salesforce\cli

svc-idee-bot commented 1 month 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.

jasonmatos commented 1 month ago

In Developer Tool found the following error :

INFO Started local extension host with pid 24320. workbench.desktop.main.js:sourcemap:660

WARN [mainThreadStorage] large extension state detected (extensionId: salesforce.salesforcedx-vscode-core, global: true): 613.0625kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead. workbench.desktop.main.js:sourcemap:97

[Extension Host] adding AppInsights reporter. workbench.desktop.main.js:sourcemap:660

INFO [perf] Render performance baseline is 13ms

I tried to following :

  1. In the Explorer view of the sidebar, delete the .sfdx and .sf folders.
  2. Close VSCode
  3. Open VSCode
  4. Authorize to your org successfully
  5. But Default Org not set properly
  6. Close VSCode
  7. Open VSCode Same error as above and extension not loading
daphne-sfdc commented 1 month ago

Can you try doing a complete clean of your extensions? Open a new Command Prompt window. Run %USERPROFILE%\.vscode\extensions and for /d %i in (salesforce.salesforcedx*) do rmdir /s /q "%i", then reinstall the Salesforce Extension Pack.

jasonmatos commented 1 month ago

I did open a new Command Prompt window. Run cd %USERPROFILE%\.vscode\extensions and for /d %i in (salesforce.salesforce*) do rmdir /s /q "%i"

Note : salesforce.salesforcedx, left salesforce.salesforce-vscode-slds-2.0.9 so changed to salesforce.salesforce

But same error when loading exting folder.

jasonmatos commented 1 month ago

I also tried to create a brand new project using the following CLI command sf project generate --name bug --template empty

I was able to get the extension loading I was able to authorize an org successfully

But the No Default Org Set was still visible in the bottom status bar image

the sf org list listed the org as Connected and as Default Org

Restarted VSCode Back to initial error where the extension not stuck in Activating

daphne-sfdc commented 1 month ago

I assume you have already tried restarting your computer?

daphne-sfdc commented 1 month ago

One more thing - In your VSCode Terminal, can you run these 4 commands in the Command Prompt and send us the results? I want to make sure you don't accidentally have multiple versions of the Salesforce CLI on your computer that conflict with each other.

  1. sfdx --version
  2. sf --version
  3. where sfdx
  4. where sf
jasonmatos commented 1 month ago

Yes, I restarted the computer multiple time since I started having the issue. I'm not sure if it is linked with the version of VS Code or the Extensions.

I also tried to uninstall VSCode and reinstall it.

sfdx --version
@salesforce/cli/2.62.6 win32-x64 node-v20.9.0
sf --version
@salesforce/cli/2.62.6 win32-x64 node-v20.9.0
where sfdx
C:\Users\[myUser]\AppData\Roaming\npm\sfdx
C:\Users\[myUser]\AppData\Roaming\npm\sfdx.cmd
where sf
C:\Users\[myUser]\AppData\Roaming\npm\sf
C:\Users\[myUser]\AppData\Roaming\npm\sf.cmd

Salesforce CLI was installed with npm

node --version
v20.9.0
daphne-sfdc commented 1 month ago

To help us diagnose the issue, can you go to your User settings and check that Salesforcedx-vscode-core › Telemetry: Enabled is enabled? Also, please set Salesforcedx-vscode-core: SF_LOG_LEVEL to "trace", the reload the VSCode window.

After you change the settings, please send us the following info:

The case where the CLI Integration extension does not activate: In your Output Tab, do you have a "Salesforce CLI" option in the dropdown? If yes, we would like the contents of that tab when the CLI Integration extension is stuck in "Activating" status.

The case where the CLI Integration extension activates but you are unable to authorize an org: What if you authorize an org using the CLI? Are you able to set the default the org that you just authorized in VSCode?

jasonmatos commented 1 month ago

The case where the CLI Integration extension does not activate The Output for "Salesforce CLI" is empty

The Output for "Extension Host"

2024-10-30 15:50:21.666 [info] Extension host with pid 25480 started
2024-10-30 15:50:21.666 [info] Skipping acquiring lock for c:\Users\[MyUser]\AppData\Roaming\Code\User\workspaceStorage\1e4aaa1b9280a7df11812f8297aa74c1.
2024-10-30 15:50:21.781 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2024-10-30 15:50:21.784 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-core, startup: true, activationEvent: 'workspaceContains:sfdx-project.json', root cause: salesforce.salesforcedx-vscode-apex
2024-10-30 15:50:21.986 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2024-10-30 15:50:22.001 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2024-10-30 15:50:22.036 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2024-10-30 15:50:31.732 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-10-30 15:50:31.738 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'

The case where the CLI Integration extension activates but you are unable to authorize an org Deleting the .sf and .sfdx folders of the projet and reloading the VSCode window seems to make the extension activate The Output for "Salesforce CLI"

Starting SFDX: Refresh SObject Definitions

15:58:41.21 sf sobject definitions refresh
Unable to process sObjects when not in a SFDX Project c:\Users\[MyUser]\bug\.sfdx
15:58:41.22 sf sobject definitions refresh
 ended with error Unable to process sObjects when not in a SFDX Project c:\Users\[MyUser]\bug\.sfdx

15:58:41.22 sf sobject definitions refresh
 ended with exit code 1

As for the default org, not even running the authentication via command line does not update the Default Org in VSCode.

Running the following CLI command sf org login web --instance-url https://[myDomain].sandbox.my.salesforce.com --set-default -a Demo OR sf config set target-org Demo

In both case, the following output was displayed in the Developer Tool :

[Extension Host] Project is not for ISV Debugger
console.ts:137 [Extension Host] Deleted environment variables SF_TARGET_ORG and SF_ORG_INSTANCE_URL
CristiCanizales commented 1 month ago

hi @jasonmatos, after auth, if you check .sf/config.json or .sfdx/sfdx-config.json files, do you see your org set there? After verifying, Can you manually try to set your default org with command SFDX: Set a Default Org from command palette?

jasonmatos commented 1 month ago

Hi @CristiCanizales yes after Auth using either method CLI commands the both .sf/config.json and .sfdx/sfdx-config.json files were created.

But using the command pallet SFDX: Set a Default Org

Basically this command pallet does nothing

Note : I notice that by removing both .sf/config.json and .sfdx/sfdx-config.json makes the extesion start successfully after a restart of VsCode.

daphne-sfdc commented 1 month ago

Hi @jasonmatos, Thank you for sharing this info. We'd like to check our telemetry to see if we can get some insights from there. Can I assume you already followed the steps in my previous message to check Salesforcedx-vscode-core › Telemetry: Enabled and set Salesforcedx-vscode-core: SF_LOG_LEVEL to "trace"? In addition to those, there's one more thing that would help us a lot: set Salesforcedx-vscode-core: Telemetry-tag to a unique value and let us know what you set it to - that way we can filter our telemetry entries to only yours.

jasonmatos commented 1 month ago

Hi @daphne-sfdc, Yes indeed the setting were set as requested. I set the Telemetry-tag to jasonmatos5929 I guess I need to redo the step so you get the info.

daphne-sfdc commented 1 month ago

Yes, please redo the step and let me know when you are done.

jasonmatos commented 1 month ago

The 2 scenarios were redone yesterday around 1030h-1040h and were redone today around 0920h-0930h

daphne-sfdc commented 1 month ago

Thank you. I'll check the telemetry and let you know what I find.

daphne-sfdc commented 1 month ago

Interesting... I was not able to find telemetry for either of your redos. I ran the same commands and was able to find telemetry for myself. It's ok, we can continue diagnosing from here.

You previously said "The Popup Running SFDX: Set a Default Org shows up and stays there forever".

  1. What kind of org are you using? (Developer org, scratch org, sandbox, Trailhead Playground?)
  2. Does it matter which org you try to set as the default? Are you getting the error with all orgs, or are you able to set some orgs as the default but not others?
jasonmatos commented 3 weeks ago

Hi @daphne-sfdc I think you should now see the Telemetry. I had to Developer : Set Log Level... to Trace in VsCode first everytime I start VsCode as well. Now I see an Telemetry element in the Ouput tab with some

  1. What kind of org are you using? Im trying to connect to a simple Developer Sandbox from an Enterprise Edition. I also tried an Trailhead playground with the same result.

  2. Does it matter which org you try to set as the default? Are you getting the error with all orgs, or are you able to set some orgs as the default but not others? Yes I'm gettting the same behavior with all types of org or different org.

This morning, Im not sure how I got an salesforce.salesforcedx-vscode-core-unresponsive.cpuprofile.txt salesforce.salesforcedx-vscode-core-unresponsive.cpuprofile.txt

daphne-sfdc commented 3 weeks ago

I still don't see any telemetry for the telemetry tag jasonmatos5929. I have seen the unresponsive CPU profile error before in my Windows VM. It always went away when I reloaded the VSCode window.

jasonmatos commented 3 weeks ago

@daphne-sfdc It seems there was an issue with VsCode itself. I followed the steps from VsCode for an Clean uninstall without uninstalling it (https://code.visualstudio.com/docs/setup/uninstall)

Clean uninstall If you want to remove all user data after uninstalling VS Code, you can delete the user data folders Code and .vscode. This will return you to the state before you installed VS Code. This can also be used to reset all settings if you don't want to uninstall VS Code.

The folder locations will vary depending on your platform:

Windows - Delete %APPDATA%\Code and %USERPROFILE%\.vscode.

I re-installed the Salesforce extension and everything started working again.

Thank you for your time.

daphne-sfdc commented 3 weeks ago

Thank you for the update and for sharing your solution - today I learned something new. 😀 I'm very happy to hear that you were able to resolve the issue and get yourself unblocked!