3

I'm using VScode for Apex dev. I have logged into Devhub org. and created a scratch org. when I try to execute pallet command:

SFDX: Refresh SObject Definitions

I'm getting below error.

enter image description here

No sfdx-project.json found in the root directory of your open project. Open a Salesforce DX project in VS Code.

Either I may be doing something silly/wrong, but I see the sfdx-project.json file in current folder which is root folder of project I believe. enter image description here

Any clue/workaround for this error? appreciate any help. Thanks.

  • Tried updating sfdx? I think syntax is 'sfdx update' off the top of my head. Your comment below about command missing sounds like Salesforce extensions error bubbling through vs code, rather than vs code itself. Other than that, reinstall Salesforce extensions. – frackham Dec 13 '18 at 7:56
  • Also, what does sfdx force:org:list show against your Dev hub? – frackham Dec 13 '18 at 7:56
  • @frackham for some reason, those commands are working, but pallet's clickable commands were not working. – Pasan Eeriyagama Dec 14 '18 at 2:57
3

You're missing a configuration file for some reason. Try the following.

Close all files and folders in Visual Studio Code, then close it entirely.

Create a new folder in your project directory called .vscode. Windows Explorer won't let you do this, so do it from a terminal:

mkdir ".vscode"

Go in to this folder and create a new file called settings.json. The contents of this file should be as follows:

{
    "terminal.integrated.env.osx": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    },
    "terminal.integrated.env.linux": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    },
    "terminal.integrated.env.windows": {
        "SFDX_SET_CLIENT_IDS": "sfdx-vscode"
    }
}

Afterwards, reopen the entire folder, and everything should start working.


If this doesn't work for some reason, you will probably need to create a new project entirely. Create a new project with "SFDX: Create New Project" and follow the prompts. The newly created project should have the Visual Studio Code configuration files you need. Afterwards, you may need to authorize your orgs again, or you can try copying the .sfdx folder from the old project folder.

  • Thank you @sfdcfox, I used to create project from typing command., apparently when I tried selecting the create project it didn't work either, threw command missing error. followed: 1. Open Run (Win + R), located %appdata%. 2. Deleted the folder Code., reopened vscode and tried Command pallet commands. They started working. still unfortunately SObject definitions are not appearing when I press ctrl+space. – Pasan Eeriyagama Nov 29 '18 at 5:37
  • @PasanE I don't even know if auto-complete works. At least, I've never seen it work. Might be a setting I'm missing. But at least if you can get past the error, it sounds like you're up and running. – sfdcfox Nov 29 '18 at 6:00
  • It seems to be working as they demo here – Pasan Eeriyagama Nov 30 '18 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.