Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error deploying or retrieving source: #5850

Closed
YavuzCemal opened this issue Sep 16, 2024 · 30 comments
Closed

Error deploying or retrieving source: #5850

YavuzCemal opened this issue Sep 16, 2024 · 30 comments

Comments

@YavuzCemal
Copy link

Similar problem to this issue no: 5433

Summary
package.xml Retrieve process suddenly stopped working for different orgs

Steps To Reproduce:
Create new project with manifest
Open package.xml in manifest folder.
Right click -> Retrieve Source from org

Expected result
The command should execute successfully.

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

sfdx-project.json file:
{
"packageDirectories": [
{
"path": "force-app",
"default": true
}
],
"name": "my QA 3",
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com/",
"sourceApiVersion": "61.0"
}

Salesforce Extension Version in VS Code: 61.12.0

sf CLI Version: @salesforce/cli/1.86.7-legacy.0 win32-x64 node-v18.15.0

OS and version: Windows 10 Enterprise

VS Code version: 1.93.1

@svc-idee-bot
Copy link
Collaborator

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@svc-idee-bot
Copy link
Collaborator

Hello @YavuzCemal 👋 It looks like you didn't provide all the required basic info in your issue.

If you haven't already, please provide the following info:
Salesforce Extension Version in VS Code:
Salesforce CLI Version:
OS and version:
VS Code version:
Most recent version of the extensions where this was working:

Here's an example of a set of required info that will pass the validation:
Salesforce Extension Version in VS Code: 60.13.0
Salesforce CLI Version: @salesforce/cli/2.42.6 darwin-arm64 node-v18.18.2
OS and version: MacOS Sonoma 14.5
VS Code version: 1.89.1
Most recent version of the extensions where this was working: 60.11.0

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue, as well as all error messages that you see.
    • A repository that clearly demonstrates the bug is ideal.
    • Error messages can be found in the Problems Tab, Output Tab, and from running Developer: Toggle Developer Tools in the command palette.
  • Make sure you've installed the latest version of the Salesforce Extension Pack for VSCode. (docs)
  • Search GitHub for existing related issues.

Thank you!

@YavuzCemal
Copy link
Author

Salesforce Extension Version in VS Code: 61.12.0
Salesforce CLI Version: @salesforce/cli/1.86.7-legacy.0 win32-x64 node-v18.15.0
OS and version: Windows 10 Enterprise
VS Code version:1.93.1
Most recent version of the extensions where this was working: 61.12.0

@svc-idee-bot
Copy link
Collaborator

Hello @YavuzCemal 👋

It looks like you're using an outdated version of Salesforce CLI. sf (v1) is no longer supported by the Salesforce Extensions for VSCode as of April 3, 2024. We highly recommend you move from sf (v1) to sf (v2) ASAP.

Moving to sf (v2) is easy and takes just two commands. Find all the information here.

After you move to the latest version of sf (v2), run your command again and see if the CLI upgrade resolves your issue. If the issue still persists, please provide the output of sf --version and we can continue diagnosing.

@YavuzCemal
Copy link
Author

moved to new version but problem persist
Salesforce CLI Version: @salesforce/cli/2.58.7 win32-x64 node-v20.17.0

@CristiCanizales
Copy link
Contributor

Hi @YavuzCemal, sorry, according to your previous comment where you provided the versions, you mentioned that the most recent version where deploy/retrieve to/from manifest was working is also 61.12.0, so same as the current version you have where it's not working, is that right?

@YavuzCemal
Copy link
Author

Yes it is. Also single file deployment and retrieve works properly.

@CristiCanizales
Copy link
Contributor

Then do you recall you made any changes in your project/org? I'm asking because the extensions version is the same so nothing changed there😅
Also, if you create a new manifest in that same project with let's say only apex classes, does deploy/retrieve work?

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 16, 2024

I didn't make any changes actually. Also since I work for multiple orgs that are in test.salesforce.com, this function going down for multiple may direct somewhere else.

I recently I had another error about package.xml and changed it to be defined as xml file but after that it was working. I don't know whether this is a relevant information.

The attempt directly result with following error, whether only one or multiple metadata statements:

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

This is mationed error file: sfdx-project.json
{
"packageDirectories": [
{
"path": "force-app",
"default": true
}
],
"name": "my QA 3",
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "61.0"
}

Maybe I should just reinstall vscode
PS: Reinstalation did not solve the problem

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 16, 2024

Hi @CristiCanizales is this relevant?

[{
"resource": "/c:/Users/username/VS Code Projects/company QA 3/sfdx-project.json",
"owner": "generated_diagnostic_collection_name#14",
"code": "768",
"severity": 4,
"message": "Unable to load schema from 'c:\Users\username\.vscode\extensions\salesforce.salesforcedx-vscode-core-61.12.0\node_modules\@salesforce\schemas\sfdx-project.schema.json': ENOENT: no such file or directory, open 'c:\Users\username\.vscode\extensions\salesforce.salesforcedx-vscode-core-61.12.0\node_modules\@salesforce\schemas\sfdx-project.schema.json'.",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}]

PS: this was irrelevant to this topic but it is solved meanwhile in here 5840

@CristiCanizales
Copy link
Contributor

Thank you for the details. If you try through the CLI, does it work? The command would be sf project retrieve start --manifest path/to/package.xml

@YavuzCemal
Copy link
Author

No, its not working

Error (2): Parsing --manifest
No file found at path/to/package.xml
See more help with --help

image

@CristiCanizales
Copy link
Contributor

Oh, you need to replace path/to/package.xml with the path to your package.xml 🙂

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 16, 2024

Okay wrote sf project retrieve start --manifest manifest/package.xml
and looks like it worked. Since it was too much line Teminal only shows staticResources atm.

tried again to right click and retrieve from file and still has the error

@diyer
Copy link
Collaborator

diyer commented Sep 17, 2024

Hi @YavuzCemal , thank you for filing this issue. Can you please create a small video showing the following details so we can better understand what is going on -

  • retrieve using sf command
  • retrieve using vscode (and with the error you are seeing)
  • show what is running in Developer Tools (run command Toggle Developer Tools)
  • Output tab of cli in vscode

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 17, 2024

Hi @diyer,
I am not able to create a video but here are the pictures of what is happening

  • sf commands works successfully
    image

  • right click -> 'SFDX: Retrieve This Source from Org' directly gives the following error. Other files like apex or LWC runs this command successfully. (Output tab is here also)
    image

  • running command 'Toggle Developer Tools' didnt work but is this console error what you are looking for?
    image

  • Additionally I have this in problem tab:
    image

@diyer
Copy link
Collaborator

diyer commented Sep 17, 2024

Thank you for providing additional information @YavuzCemal . We will continue to look into this and update you soon.

@CristiCanizales
Copy link
Contributor

Hi @YavuzCemal, in the screenshot you provided looks like the request is pending for the cli command. Can you send a screenshot of the successful retrieval using cli?
image

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 18, 2024

Hi @CristiCanizales, here it is.
PS: I've just downloaded Cursor and it has the same scenario, package.xml error, and single file success.

image

@CristiCanizales
Copy link
Contributor

Could you also run Developer: Show Running Extensions from command palette and share the screenshot of all extensions running?

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 18, 2024

Here are they::
PS: 'Extension causes high cpu load' is the automated issue header for github.
image
image

@CristiCanizales
Copy link
Contributor

So the CLI Integration extension shows unresponsive. Could you go to .vscode/extensions global folder and delete all extensions starting with salesforcedx, quit and restart vscode and reinstall extensions and see if the issue persists?

@YavuzCemal
Copy link
Author

I deleted all extansion and restarted vscode and issue persist.
But CLI has no Issue atm.

image

@CristiCanizales
Copy link
Contributor

Can you try running command "SFDX: Create Project", name it "test" (or something with no spaces), connect to the same org and copy and paste that same package.xml from the other project and see if that works?

@YavuzCemal
Copy link
Author

Created project without manifest, named it issuetesting (with no spaces). connected to same org. Copy pasted manifest folder.
Right click, 'Retrieve' still doesn't work.

image

@CristiCanizales
Copy link
Contributor

Hello @YavuzCemal, thank you for your patience and trying every suggestion. Can you open your manifest and send me a screenshot of the whole VSCode window including your bottom bar? I want to verify the items there. Like this
image

@YavuzCemal
Copy link
Author

Sure

image

@CristiCanizales
Copy link
Contributor

Right! I think we may have bingo (? Could you click in the bottom bar to the very right where it says XML and change it to ForceSourceManifest and try again?

@YavuzCemal
Copy link
Author

YavuzCemal commented Sep 19, 2024

Bingo!
Looks like this action caused the problem but it took a while me to face it.

changed it to be defined as xml

Thank you @CristiCanizales

@sfelius
Copy link

sfelius commented Oct 2, 2024

Great find @CristiCanizales ! This saved me hours of frustration.
I had to add package.xml to my file associations in settings.json to keep it from reverting back to XML. Hope this helps others 😄

"files.associations": {
    "*.xml": "xml",
    "package.xml": "forcesourcemanifest"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants