forcedotcom / salesforcedx-vscode

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

Improved error handling for invalid sfdx-project.json files #938

Closed shorwood closed 2 years ago

shorwood commented 6 years ago

Summary

The only command showing up when i press F1 is SFDX: Create Project, even though my project has all the necessary files.

What i tried: Opening the Dreamforce and Simple projects. Reinstalling the Salesforce extensions. Reinstalling VSCode Reinstalling SFDX CLI Setting up the scratch org through sfdx.exe.

Manually pulling and pushing through sfdx.exe worked as expected.

Steps To Reproduce:

Create a project and open it in VSCode.

Expected result

The full set of SFDX commands available.

Actual result

Can only access "SFDX: Create Project" command.

Additional information

capture

VS Code Version: Stable 1.19.3

Java JDK Version: 8u161

SFDX CLI Version: sfdx-cli/6.1.19-4341549 (windows-x64) node-v8.9.4

OS and version: Windows 10 (16299.192)

Internal Work Item: #W-5171263

vazexqi commented 6 years ago

@Youpala - Very weird. I see that you have sfdx-project.json available at the top level.

This might be related to https://github.com/forcedotcom/salesforcedx-vscode/wiki/Troubleshooting#extensions-malfunction-after-update

BUT before you do that, could you try the following:

  1. What happens if you try to execute the SFDX: Create Project command? I suspect that it actually fails but could you confirm?
  2. In the VS Code menu bar, select Help > Toggle Developer Tools, click Console, and search for relevant messages. What errors do you see?
vazexqi commented 6 years ago

@Youpala - Any updates on your side? I've not been able to reproduce this issue on my side.

shorwood commented 6 years ago

I willl try to look into it this week end but I couldn’t reproduce this issue on my personal computer either. Only my office labtop had this issue. It might be caused by some faulty parameters on that particular computer.

puppiesaroundtheworld commented 6 years ago

I encountered a similar issue on my desktop with the latest version of VS Code (1.20) on Windows Server 2016; in the Developer Tools Console there was a message (that I regretfully did not screen capture) informing me the Salesforce vscode extension could not find the module './util/root'. I believe I may have reloaded the window after a small extension had finished updating but not before the Salesforce extension had finished updating. Removing and adding the Salesforce extension back to VS Code did not fix the issue for me, but may for others.

To fix I closed VS Code, went to %USERPROFILE%\.vscode\extensions and deleted every folder beginning with "salesforce." The following command will print out the folders to be deleted, and can delete them by removing the echo:

for /f %i in ('dir /a:d /s /b %USERPROFILE%\.vscode\extensions\salesforce*') do echo rd /s /q %i

Linux / Mac users: I think rm -rf ~/.vscode/extensions/salesforce* should work, but as with all rm -rf suggestions use with caution.

After this open VS Code, and the Salesforce extension should be missing from your extensions section (CTRL+SHIFT+X). After installing the Salesforce extension and reloading the window the SFDX commands should be available once more.

Two of the symptoms of this issue for me were the Salesforce Extension taking a strangely short time to install when removing/reinstalling the extension through the VS Code UI without deleting the files, and not getting the error informing me Java could not be found if I removed the "salesforcedx-vscode-apex.java.home" setting in my User Settings. If this setting is not needed for you, then this won't be a problem in the first place.

vazexqi commented 6 years ago

@VodkaSurprise - Thanks for the insight.

I believe I may have reloaded the window after a small extension had finished updating but not before the Salesforce extension had finished updating

I speculate that it is possible to get into a weird state where an extension (not just ours) isn't fully installed yet. If you were to reload/close the window before it finishes installing, then the extension is not completely installed. This will explain the "could not find module ./util/root since it could be missing certain portions.

alekhSharma commented 6 years ago

@VodkaSurprise - Hello , I am also facing the same error even after the deletion of all salesforce files from extensions folder. I am getting only Sfdx create project command. Select that command shows error "no command found" .Your insight on this topic will be very helpful for me.

thanks in advance image

alekhSharma commented 6 years ago

I solved this issue for myself. The problem was due to inproper sfdx-project.json file. I create a folder and added sfdx-project.json as { "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sourceApiVersion": "42.0" }

Then try to run the command, and it worked perfectly.

lcampos commented 5 years ago

Closing this since release v44.6.0 now has schema validation for sfdx-project.json and project-scratch-def.json.

ntotten commented 5 years ago

@lcampos This actually isn't the same thing. The issue in this issue is that the extension won't activate if the sfdx-project.json isn't valid, but there is no way to figure out why. The proposed fix is to always load the extensions if the sfdx-project.json file exists, regardless of if it is valid or not. Once the extension is loaded, you would then be able to open the file and use the schema validation to determine that the file is invalid.

lcampos commented 5 years ago

I see, thanks for clarifying it @ntotten

chandrayetukuri commented 4 years ago

I am getting the below Invalid Version Number Error while authorizing Sandbox from VSCode:-

From PROBLEM section of VS Code:- Unable to load schema from 'https://forcedotcom.github.io/schemas/sfdx-project.json/sfdx-project.schema.json': write EPROTO 815493656:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../thirdparty/boringssl/src/ssl/tls...

From OUTPUT section of the VS Code:-

ERROR running force:auth:web:login: tunneling socket could not be established, cause=write EPROTO 7008:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:252:

jag-j commented 2 years ago

We have made several improvements to the extension since this issue was created. Please reopen if you still have this issue.