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

force:source:retrieve returns error when 'retrievetargetdir' is set and metadata not found in target org #1823

Closed
mrichbb opened this issue Nov 23, 2022 · 2 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@mrichbb
Copy link

mrichbb commented Nov 23, 2022

Summary

When specifying a target directory using the force:source:retrieve command and the metadata in a provided manifest is not present in the source organization, an error is thrown.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

  1. Create a scratch org for dreamhouse-lwc and push its source there
    sfdx force:org:create -a dreamhouse-lwc -f config/project-scratch-def.json
    sfdx force:source:push
  2. Create a package manifest with the following contents and save as package.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <types>
            <members>ldsUtils</members>
            <members>ldsUtilsNotFound</members>
            <name>LightningComponentBundle</name>
        </types>
        <version>56.0</version>
    </Package>
    
  3. Retrieve the contents of the manifest from the scratch org and specify a target directory
    sfdx force:source:retrieve -u dreamhouse-lwc -x package.xml --retrievetargetdir ./source-retrieve/

Expected result

  • A report of the retrieved metadata is displayed, along with warnings for the metadata that was not present in the org
  • The metadata that was retrieved is placed in the target directory

Actual result

  • An error is displayed
    ERROR running force:source:retrieve: Cannot read properties of undefined (reading 'replace')
  • The metadata that was retrieved is placed in the target directory

System Information

{
  "cliVersion": "sfdx-cli/7.177.1",
  "architecture": "wsl-x64",
  "nodeVersion": "node-v18.12.1",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.3.5 (core)",
    "@oclif/plugin-commands 2.2.1 (core)",
    "@oclif/plugin-help 5.1.18 (core)",
    "@oclif/plugin-not-found 2.3.8 (core)",
    "@oclif/plugin-plugins 2.1.6 (core)",
    "@oclif/plugin-update 3.0.6 (core)",
    "@oclif/plugin-version 1.1.3 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.13 (core)",
    "@oclif/plugin-which 2.2.0 (core)",
    "@salesforce/lwc-dev-server 2.11.0 (user)",
    "alias 2.1.8 (core)",
    "apex 1.3.0 (core)",
    "auth 2.2.21 (core)",
    "community 2.0.15 (core)",
    "config 1.4.22 (core)",
    "custom-metadata 2.0.4 (core)",
    "data 2.1.10 (core)",
    "generator 2.0.10 (core)",
    "info 2.2.7 (core)",
    "limits 2.0.11 (core)",
    "org 2.2.12 (core)",
    "packaging 1.10.6 (core)",
    "schema 2.1.13 (core)",
    "signups 1.2.12 (core)",
    "source 2.3.4 (core)",
    "telemetry 2.0.3 (core)",
    "templates 55.1.0 (core)",
    "trust 2.1.0 (core)",
    "user 2.1.17 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "salesforce-alm 54.8.3 (core)"
  ],
  "osVersion": "Linux 4.19.104-microsoft-standard",
  "shell": "zsh",
  "rootPath": "/home/<redacted>/.nvm/versions/node/v18.12.1/lib/node_modules/sfdx-cli"
}

Additional information

image

@mrichbb mrichbb added the investigating We're actively investigating this issue label Nov 23, 2022
@github-actions
Copy link

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.

@peternhale peternhale added the bug Issue or pull request that identifies or fixes a bug label Nov 28, 2022
@git2gus
Copy link

git2gus bot commented Nov 28, 2022

This issue has been linked to a new work item: W-12128219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants