salesforcedx-vscode: Unable to deploy/retrieve using SFDX: Deploy Source to Org / Retrieve Source from Org
Summary
I am unable to use SFDX: Deploy Source to Org or SFDX: Retrieve Source from Org. Whenever I attempt to run those commands on a file or folder, I get the following error:
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn’t in a package directory that’s specified in your sfdx-project.json file. Add this location to your “packageDirectories” value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm
I am able to use SFDX: Deploy Source in Manifest to Org and SFDX: Retrieve Source from Manifest to Org. I am also able to deploy individual files using the command sfdx force:source:deploy --sourcepath '.\force-app\main\default\classes\Test.cls' --json --loglevel trace
without any issues.
This had been working for my project, then suddenly stopped recently. I don’t remember making any configuration changes. Things I have tried:
- Updating the CLI
- Opening a different project that had never had any problems
- Uninstalling and reinstalling the VSCode extensions
- Creating a new directory and adding it to my sfdx-project.json file
- Removing everything from my manifest except ApexClass
- Creating a brand new project using SFDX: Create Project with Manifest -> Standard, connecting to a sandbox I’d never connected to previously, creating a new Apex file, and deployment without making any other changes to the project
Steps To Reproduce:
- Right-click on a file (apex class, list view, etc.) or folder (classes, layouts, etc.)
- Select SFDX: Deploy Source to Org or SFDX: Retrieve Source from Org
Expected result
The component(s) should be deployed to the org or retrieved from the org
Actual result
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn’t in a package directory that’s specified in your sfdx-project.json file. Add this location to your “packageDirectories” value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm
Additional information
Salesforce Extension Version in VS Code: v56.14.0
SFDX CLI Version: sfdx-cli/7.182.1 win32-x64 node-v18.12.1
OS and version: Windows 10
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 24 (10 by maintainers)
I received the same error with Salesforce Extension Pack v60.2.3, when using the keyboard shortcut
alt+cmd+d
. The shortcut was associated in the following way:Replacing it with the following config fixed the issue:
It appears to be a typical local folder that’s just synced back to our company OneDrive instance. Nothing special that I can see. I don’t think it’s ever been renamed but I can’t be sure.
Here’s the saved output vscode-app-1676563830395.log
Yesterday’s release did not resolve the issue for me.
@cprimus4F What type of org are you deploying to (sandbox, scratch, dev)?
Also would be interesting to know what’s in your .sfdx/sfdx-config.json file (feel free to email me at svc_idee_bot@salesforce.com if you didn’t want to post it here).