Sunday, January 12, 2020

VSCode Common Issues for Salesforce Development

1.Issue: The Salesforce CLI is not installed

After user installs Salesforce CLI, then tries to 'Create Project with Manifest', VS Code starts creating project but errs out with the following message:
The Salesforce CLI is not installed. Install it from https://developer.salesforce.com/tools/sfdxcli

Cause: Missing or incorrect Windows Environment Variable setting.

Fix: 1.1 we need to get the full path nae of installed programs: Salesfoce CLI and Microsoft VS Code.

1.2 In Windows search box, search "Edit Environment". Control panel | Path | Edit. 


It opens Path variable setting; then New | Add folders you get in last step | OK 



2. Issue: Java runtime could not be located

When starting a Salesforce project in VS Code, there is warning saying "Java runtime could not be located. Set one using the salesforcedx-vscode-apex.java.home VS Code setting. For more information, go to Set Your Java Version."

Cause: The Apex Language Server, shipped as part of the Salesforce Apex Extension for VS Code depends upon the Java Platform, Standard Edition Development Kit (JDK). It requires an installation of either JDK version 11 (Recommended) or JDK version 8. It also requires proper settings in VS Code.

Fix: 2.1 Install JDK v11 or V8. Get the full path name of installed JDK. (i.e. C:\Program Files\Java\jdk-11.0.5)
       2.2 Select File > Preferences > Settings (Windows or Linux) or Code > Preferences > Settings (macOS).
       2.3 Search for apex.
       2.4 Change the salesforcedx-vscode-apex.java.home setting to the full pathname of your Java Runtime. 

  3. Issue: unable to authorize an org behind a company firewall
There are many cases user cannot authorize an org in VS code.
The one I am addressing is this post is about company security policy does not allow using port 1717 on user's computer.

When user tries to authorize a Salesforce org with oAuth, user gets "localhost 1717 Oauth Redirect" error at the redirect step.

Cause: One of the causes is company security policy does not allow using port 1717 on your computer.

Fix:  3.1 Find a public VPN as proxy server.
        3.2 Add HTTP_Proxy and HTTPs_Proxy Windows Environment Variables
        The format is:
        https_proxy=http://username:password@proxy.example.com:port
        https_proxy=http://username:password@proxy.example.com:port





No comments:

Post a Comment