forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
491 stars 79 forks source link

sfdx project retrieve start error while retrieving metadata #2112

Closed adityasfdev closed 1 year ago

adityasfdev commented 1 year ago

Summary

 while trying to retrieve metadata from sandbox using "sfdx project retrieve start -x package.xml -o my-sandbox -t delta/."

im getting below error. please help me to resolve the above issue.

Expected result

components needs to be retrieved in the metadata format

Actual result

Error (1): fast_xml_parser_1.XMLParser is not a constructor Preparing retrieve request... done

github-actions[bot] commented 1 year ago

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.

mshanemc commented 1 year ago

Can you provide the version information that the issue template requests?

adityasfdev commented 1 year ago

@mshanemc are you asking about the sfdx cli version or what?

if you are mentioning about the cli version here the version im using sfdx-cli/7.197.8 win32-x64 node-v18.15.0

here my proj structure image

mshanemc commented 1 year ago

yeah, if you click new issue and select bug report the template asks for some info so we get the cli version and plugin versions so we know where to look and what plugin we can use to replicate your issue.

adityasfdev commented 1 year ago

okay thanks for the clarification and i provided some information that you asked in the previous comment let me know if you need anything else will provide it too.

mshanemc commented 1 year ago

can you run sfdx version --verbose to see what the plugin versions are?

adityasfdev commented 1 year ago

i ran the command has you told and here is the result @mshanemc

CLI Version: sfdx-cli/7.197.8

Architecture: win32-x64

Node Version: node-v18.15.0

Plugin Version: @oclif/plugin-autocomplete 2.1.8 (core) @oclif/plugin-commands 2.2.13 (core) @oclif/plugin-help 5.2.9 (core) @oclif/plugin-not-found 2.3.23 (core) @oclif/plugin-plugins 2.4.4 (core) @oclif/plugin-search 0.0.15 (core) @oclif/plugin-update 3.1.10 (core) @oclif/plugin-version 1.3.2 (core) @oclif/plugin-warn-if-update-available 2.0.33 (core) @oclif/plugin-which 2.2.18 (core) apex 2.2.12 (core) auth 2.7.12 (core) community 2.2.9 (core) custom-metadata 2.1.12 (core) data 2.3.10 (core) deploy-retrieve 1.8.12 (core) info 2.6.6 (core) limits 2.3.12 (core) org 2.6.12 (core) packaging 1.16.5 (core) schema 2.3.7 (core) settings 1.4.4 (core) signups 1.4.12 (core) source 2.10.2 (core) telemetry 2.1.3 (core) templates 55.4.7 (core) trust 2.4.7 (core) user 2.3.8 (core) @salesforce/sfdx-plugin-lwc-test 1.0.1 (core) sfdx-cli 7.197.8 (core) sfdx-git-delta 5.17.1 (user)

OS and Version: Windows_NT 10.0.17763

Shell: C:\Program Files\Git\usr\bin\bash.exe

Root Path: C:\Program Files\sfdx\client

mshanemc commented 1 year ago

I'm looking at this and your other issue (https://github.com/forcedotcom/cli/issues/2106), and it looks like things are messed up. Can you uninstall and re-install the CLI to see if it clears things up? It's like some of the dependencies are running ahead of the plugins.

mshanemc commented 1 year ago

And if this is also in the CI, can you share the install process that you're using in that system?

adityasfdev commented 1 year ago

@mshanemc no its not in CI its in my amazon workspace and yeah ill uninstall the CLi and try installing it again lets see whether i can able to retrieve or not

adityasfdev commented 1 year ago

and that other issue #2106 i think if that warning ignored we can close that issue

github-actions[bot] commented 1 year ago

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

HerbertHBT commented 1 year ago

Hi,

My CI/CD process is broken with the same problem. After updating the Salesforce CLI to the version "sfdx-cli/7.200.7 win32-x64 node-v18.15.0"

I also tried to use the "sf project retrieve start --target-metadata-dir", but it also has a bug already reported here: https://github.com/forcedotcom/cli/issues/2089

Thanks

mshanemc commented 1 year ago

@HerbertHBT can you temporarily try sf plugins install deploy-retrieve and then the same command?

I haven't been able to replicate the error, and I'm curious if it happens in more recent versions of the plugin

adityasfdev commented 1 year ago

Hi @HerbertHBT i can able to retrieve and deploy in my CI CD by just adding the sfdx-project.json file in my source repo

sfdx-project.json


{ "packageDirectories": [ { "path": "src", "default": true } ], "name": "SalesforceDeployment", "namespace": "", "sfdcLoginUrl": "https://test.salesforce.com", "sourceApiVersion": "56.0" }

mshanemc commented 1 year ago

fyi, we are going to make this work without a project soon.

HerbertHBT commented 1 year ago

Hi @adityasfdev,

My CI/CD jobs are using package.xml to retrieve and deploy changes. We don't have the sfdx-project.json in place and we don't need it.

The "sf project retrieve start --target-metadata-dir" should work similarly to "force:mdapi:retrieve --retrievetargetdir" according to the documentation. But anyways, the main problem here is that a sfdx should not spot working just by updating the sfdx version, right?

Here is the complete command line that stopped working.

sfdx force:mdapi:retrieve -r "C:\SFDC\Deployment\Backup" -k "C:\SFDC\Deployment\package.xml" -a 57.0 -u ProdEnvironment

and here is the error message I found in the Jenkins job log:

Error (1): fast_xml_parser_1.XMLParser is not a constructor

Thanks

HerbertHBT commented 1 year ago

Hi @mshanemc,

Just FYI, I don't know what the root cause was, but after uninstalling the Salesforce CLI, restarting the Server, and finally installing the Salesforce CLI again, then the issue stopped happening. I've installed the same version (sfdx-cli/7.200.7 win32-x64 node-v18.15.0) and everything looks good now.

Thanks

mshanemc commented 1 year ago

I've seen various things that look like this--it's like some of the node modules get out of sync when updates happen.

I've not had it happen to me, and it's almost impossible to debug. Uninstall/re-install is kinda like rebooting a windows machine in terms of magic.

github-actions[bot] commented 1 year ago

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.