3

I have an sfdx project opened in VS Code as workspace folder. I don't see the option for "SFDX: Push Source to Default Scratch Org" in the command palette. Other commands like "SFDX: Refresh SObject Definitions" are visible and I can execute them just fine.

enter image description here

This question No Option for “SFDX:Authorize an Org” command in VS Code Command Palette does not help, since I have an sfdx project already.

Edit

In my case I am logged in a scratch org with a namespace.If I run the command sfdx force:org:push in the command line, it gets executed just fine. And sometimes when I reopen VS Code with the same workspace folders, I can see "SFDX: Push Source to Default Scratch Org" in the command palette.

  • try to open the project not as a workspace but as a regular folder (i.e. File->Open.. instead of File->Open Workspace...) – Json May 26 at 21:37
  • @Eduard I had same problem, tried multiple things and I don't remember exactly but my guess is setting salesforcedx-vscode-apex.java.home in vscode worked, Try setting it as mentioned in the documentation. – Raul May 27 at 9:56
  • Can you try by clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. I face this issue everytime i create a new scratch org and I always have to do this step. I believe it's an issue with VS code which is unable to recognize the org as default even if scratch org is created from vs code command pallete. – Ashish Sharma May 28 at 16:25
1

Try clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. Or you can run sfdx force:config:set defaultusername=Org_Alias command from CLI or any script you are using. I face this issue everytime i create a new scratch org(4-5 times per day) and I always have to do this step. I believe it's an issue with VS code/SF cli which is unable to recognize the org as default.

1

For me it was because the Salesforce org I was logged in did not have the DevHub features enabled (under Setup/Development/Dev Hub) and also because I was (wrongly) using a DevHub which has a namespace assigned - so impossible to create Scratch Orgs.
You need to create a separate org for that - follow this link for a description.

  • Thanks. The thing is I am actually connected to a namespaced scratch org. All commands work well in the terminal, but I also want to be able to issue them via command palette. I have updated my question. – Eduard May 27 at 6:48

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.