Open wrone opened 1 year ago
Downgrade of "Salesforce CLI Integration" extension to 56.16.0 helped. I was on 57.7.0 initially.
Today I started to get the error again on the 56.16.0 version, I upgraded back to the latest version 57.7.0 and now it works fine.
Hey @wrone - if you encounter the error again, can you try reopening it as a brand new project in VS Code? We've diagnosed a similar issue where the directory gets renamed and VS Code is using the cached project name which causes issues for us downstream. The workaround is to force VS Code to load up a new project rather than use the cached one.
I'll put this one as "more info required" for now since this has been intermittent for you, but let us know if it happens again and if ^^ does the trick for you!
I'm getting this problem sporadically also. It seemed to start with Salesforce Extension Pack and VS Code update last week. sfdx update did not help. Subsequent VS Code update did not help. re-authorizing org has not helped.
Retrieve and diff work, but deploying an Apex class for example results in ""Component conversion failed: This directory does not contain a valid Salesforce DX project" error.
@wrone / @cparmenter - can either of you confirm which type of org you're working with? We should have an update soon that will output the path we're attempting to deploy which should make troubleshooting easier, but in the meantime troubleshooting in this area is a bit of a black box.
@wrone / @cparmenter - can either of you confirm which type of org you're working with? We should have an update soon that will output the path we're attempting to deploy which should make troubleshooting easier, but in the meantime troubleshooting in this area is a bit of a black box.
This has happened on both a developer edition sandbox and several regular full sandboxes, fairly recently refreshed from the production org.
The projects in all cases were created with manifest some time ago.
Thank you.
@cparmenter and @wrone, thank you both for submitting the issue. We have a potential bug fix, and would love some user testing to see if it resolves the issue. GitHub Actions created a build for the above referenced PR at the bottom of this page: https://github.com/forcedotcom/salesforcedx-vscode/actions/runs/4757146986
If you could download and install the built vsixes via VS Code's Install from VSIX feature, it would be helpful in getting this fix out quickly.
Once installed, please let us know if this build fixes the issue. Thanks in advance if you are able to help!
@cparmenter and @wrone, thank you both for submitting the issue. We have a potential bug fix, and would love some user testing to see if it resolves the issue. GitHub Actions created a build for the above referenced PR at the bottom of this page: https://github.com/forcedotcom/salesforcedx-vscode/actions/runs/4757146986
If you could download and install the built vsixes via VS Code's Install from VSIX feature, it would be helpful in getting this fix out quickly.
Once installed, please let us know if this build fixes the issue. Thanks in advance if you are able to help!
Thank you @klewis-sfdc . That does not seem to have worked for me. I installed all the .vsix files. I don't see a specific error in VSCode after closing and reloading, but nothing Salesforce-related works now. The right-click context menus for deploying are not there and no class method signature outline shows up for example.
I'm not sure where to look for an error log.
Thank you for working on this.
Ok @cparmenter thank you for checking. We are continuing to investigate the issue and will let you know when we have another build to test.
If you'd like to go back to a previous version, the "To uninstall the Pre-Release Extensions" step in this article should help: https://github.com/forcedotcom/salesforcedx-vscode/discussions/4391
Thank you. The error may have something to do with missing "messages" folders.
Hi, I am facing this problem sporadically with some of my Salesforce DX projects.
In my case, sometimes this DX project works well, but sometimes after something (no idea what may trigger this) it fails to run the SFDX: *
commands from the Command Palette, complaining with that "This directory does not contain a valid Salesforce DX project." message.
This is the Extension Host's error output after running the "SFDX: View All Changes (Local and in Default Org)"
command:
2023-08-10 14:51:06.180 [error] InvalidProjectWorkspaceError: This directory does not contain a valid Salesforce DX project.
at Messages.createError (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\messages.js:428:16)
at resolveProjectPathSync (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\util\internal.js:56:24)
at ConfigFile.resolveRootFolderSync (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\config\configFile.js:99:87)
at RemoteSourceTrackingService.getPath (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\config\configFile.js:314:30)
at RemoteSourceTrackingService.read (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\config\configFile.js:149:63)
at RemoteSourceTrackingService.init (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\core\lib\config\configFile.js:337:20)
at async RemoteSourceTrackingService.init (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:120:13)
at async RemoteSourceTrackingService.create (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\kit\lib\creatable.js:57:9)
at async RemoteSourceTrackingService.getInstance (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:82:65)
at async SourceTracking.ensureRemoteTracking (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\source-tracking\lib\sourceTracking.js:324:44)
at async SourceTracking.getStatus (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\node_modules\@salesforce\source-tracking\lib\sourceTracking.js:117:13)
at async io.getSourceStatusSummary (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\dist\index.js:32:1000)
at async wr.execute (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\dist\index.js:103:1692)
at async km (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.9.1\dist\index.js:103:2062)
at async a.h (d:\DEV\Tools\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:77769) sfdx.force.source.status {"value":"salesforce.salesforcedx-vscode-core","_lower":"salesforce.salesforcedx-vscode-core"}
Please note that I can run e.g. the sfdx force:source:status
command from VSCode Terminal (PowerShell) and it runs normally - meaning, the sfdx CLI itself considers this DX Project folder "good enough" to run those commands (at least it understands the default org selected in the project, etc).
PowerShell sfdx version --verbose
output:
{
"cliVersion": "@salesforce/cli/2.3.8",
"architecture": "win32-x64",
"nodeVersion": "node-v18.15.0",
"osVersion": "Windows_NT 10.0.19045",
"shell": "cmd.exe",
"rootPath": "C:\\Users\\<USERNAME>\\AppData\\Local\\sf\\client\\2.3.8-7de1e6e",
"pluginVersions": [
"@oclif/plugin-autocomplete 2.3.3 (core)",
"@oclif/plugin-commands 2.2.21 (core)",
"@oclif/plugin-help 5.2.15 (core)",
"@oclif/plugin-not-found 2.3.34 (core)",
"@oclif/plugin-plugins 3.1.8 (core)",
"@oclif/plugin-search 0.0.21 (core)",
"@oclif/plugin-update 3.1.28 (core)",
"@oclif/plugin-version 1.3.8 (core)",
"@oclif/plugin-warn-if-update-available 2.0.46 (core)",
"@oclif/plugin-which 2.2.29 (core)",
"@salesforce/cli 2.3.8 (core)",
"apex 2.3.9 (core)",
"auth 2.8.10 (core)",
"data 2.5.4 (core)",
"deploy-retrieve 1.16.5 (core)",
"info 2.6.35 (core)",
"limits 2.3.27 (core)",
"login 1.2.23 (core)",
"org 2.9.28 (core)",
"schema 2.3.21 (core)",
"settings 1.4.21 (core)",
"sobject 0.1.42 (core)",
"source 2.10.28 (core)",
"telemetry 2.2.3 (core)",
"templates 55.5.7 (core)",
"trust 2.5.1 (core)",
"user 2.3.27 (core)"
]
}
I'm getting this error again - on one project only. Other projects are fine. Deploying a manifest does not work, but comparing a class with server does work. I don't spot a difference between the two projects.
The sfdx-project.json was missing the following:
{ "path" : "manifest" }
I believe I created the project with the "with manifest" option and the manifest folder and a default package.xml is there.
This seems to have resolved it.
The sfdx-project.json was missing the following: { "path" : "manifest" }
I believe I created the project with the "with manifest" option and the manifest folder and a default package.xml is there.
This seems to have resolved it.
My guess is that sometimes new projects created "with manifest" are not getting the manifest folder path added to the project json file - or something removes it later.
The error message is a little misleading: "This directory does not contain a valid Salesforce DX project." - in my case it really means "There's no manifest folder or file.".
I have the SF DX project (working with a scratch org, no deploy on save
enabled; usually Source Push/Pull, but sometimes using Deploy/Retrieve on particular files/folders)) which works fine 95% of the time.
But then, from time to time, even after successfully pushing/deploying the changes in this DX Project, without doing any further changes to the project files/structure, SFDX:*
commands stop working in this DX project.
Usually, I spot that when running the SFDX: View All Changes (Local and Default Org)
command, and it adds the following stack trace to the Extension Host's Output:
2023-08-21 17:03:14.794 [error] InvalidProjectWorkspaceError: This directory does not contain a valid Salesforce DX project.
at Messages.createError (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\messages.js:393:16)
at resolveProjectPathSync (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\util\internal.js:56:24)
at ConfigFile.resolveRootFolderSync (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\config\configFile.js:99:87)
at RemoteSourceTrackingService.getPath (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\config\configFile.js:315:30)
at RemoteSourceTrackingService.read (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\config\configFile.js:149:63)
at RemoteSourceTrackingService.init (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\lib\config\configFile.js:338:20)
at async RemoteSourceTrackingService.init (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:120:13)
at async RemoteSourceTrackingService.create (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\core\node_modules\@salesforce\kit\lib\creatable.js:57:9)
at async RemoteSourceTrackingService.getInstance (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:82:65)
at async SourceTracking.ensureRemoteTracking (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\source-tracking\lib\sourceTracking.js:333:44)
at async SourceTracking.getStatus (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\node_modules\@salesforce\source-tracking\lib\sourceTracking.js:120:13)
at async so.getSourceStatusSummary (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\dist\index.js:32:1000)
at async Pr.execute (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\dist\index.js:103:1692)
at async Hm (c:\Users\<USERNAME>\.vscode\extensions\salesforce.salesforcedx-vscode-core-58.11.0\dist\index.js:103:2062)
at async a.h (d:\DEV\Tools\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:102:77769) sfdx.force.source.status {"value":"salesforce.salesforcedx-vscode-core","_lower":"salesforce.salesforcedx-vscode-core"}
I am not an expert on the TypeScript and VSCode extensions, but from the stack trace it looks like the RemoteSourceTrackingService
wants to run the getPath()
, which uses ConfigFile.resolveRootFolderSync()
; that function tries to retrieve the project path using the resolveProjectPathSync()
- and the error is thrown from that util function...
What (sometimes) helps to resolve it:
/.sf
folder; then I either restart the Extension Host, or just restart the VSCode overall. (unfortunately, also not guaranteed to fix the problem...)Could it be either that the VSCode stays idle for some long time, or, maybe if the Internet connection goes down and then up? I just ran out of ideas about what goes wrong there.
Summary
I'm not able to deploy classes from VSC using the "Deploy This Source to Org" button. I'm getting the below error:
Yesterday this error started to occur, I created a new VSC project and in the new project it was working. But today it is not working in the new project anymore.
My project is created with manifest, not scratch org.
In the same time it is working when I'm using a terminal command to deploy:
Steps To Reproduce:
Repository to reproduce:
Expected result
The class is deployed successully
Actual result
Got the "Component conversion failed: This directory does not contain a valid Salesforce DX project." error
System Information
Terminal: bash
Version: { "cliVersion": "sfdx-cli/7.194.1", "architecture": "win32-x64", "nodeVersion": "node-v18.15.0", "osVersion": "Windows_NT 10.0.19045", "shell": "cmd.exe", "rootPath": "...\AppData\Local\sfdx\client\7.194.1-faa045e", "pluginVersions": [ "@copado/copado-cli 1.1.19 (user)", "@oclif/plugin-autocomplete 2.1.6 (core)", "@oclif/plugin-commands 2.2.11 (core)", "@oclif/plugin-help 5.2.8 (core)", "@oclif/plugin-not-found 2.3.22 (core)", "@oclif/plugin-plugins 2.4.3 (core)", "@oclif/plugin-search 0.0.14 (core)", "@oclif/plugin-update 3.1.8 (core)", "@oclif/plugin-version 1.3.1 (core)", "@oclif/plugin-warn-if-update-available 2.0.32 (core)", "@oclif/plugin-which 2.2.17 (core)", "apex 2.2.7 (core)", "auth 2.7.10 (core)", "community 2.2.8 (core)", "custom-metadata 2.1.9 (core)", "data 2.3.8 (core)", "info 2.6.2 (core)", "limits 2.3.9 (core)", "org 2.6.2 (core)", "packaging 1.16.2 (core)", "schema 2.3.4 (core)", "settings 1.4.2 (core)", "signups 1.4.8 (core)", "source 2.8.0 (core)", "telemetry 2.1.3 (core)", "templates 55.4.4 (core)", "trust 2.4.5 (core)", "user 2.3.5 (core)", "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)", "sfdx-cli 7.194.1 (core)" ] }