sfpowerkit icon indicating copy to clipboard operation
sfpowerkit copied to clipboard

Merging project manifest to an empty manifest return error

Open oh-satyo-iswara opened this issue 2 years ago • 3 comments

Describe the bug When merging manifests with one manifest contain no component, merging process returned error Cannot read properties of undefined (reading 'constructor')

To Reproduce Steps to reproduce the behavior:

  1. Create 2 package manifest. a. nonEmpty-package.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <name>CustomField</name>
    <members>Account.Test__c</members>
  </types>
  <version>55.0</version>
</Package>

b. empty-package.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <version>55.0</version>
</Package>
  1. run sfdx sfpowerkit:project:manifest:merge -p nonEmpty-package.xml,empty-package.xml -d ./out
  2. Result : error with message ERROR running sfpowerkit:project:manifest:merge: Cannot read properties of undefined (reading 'constructor')

Expected behavior out/package.xml contains the same component as nonEmpty-package.xml

Screenshots N/A

Desktop (please complete the following information):

  • OS: MacOX
  • Node Version : v16.14.2
  • Version of sfpowerkit : 6.0.0
  • Salesforce Org Version - v55.0

Additional context N/A

oh-satyo-iswara avatar Oct 05 '22 20:10 oh-satyo-iswara

Suggestion for fix on src/commands/sfpowerkit/project/manifest/merge.ts add checking on metadataTypes (metadataTypes !== undefined) in processMainfest method.

oh-satyo-iswara avatar Oct 05 '22 20:10 oh-satyo-iswara

Can I ask what the use case is for merging with an empty package.xml?

Caitlyn-Mills avatar Oct 05 '22 23:10 Caitlyn-Mills

Yes, the use case is as a part of our CI, at the beginning of each sprint, we start with empty package.xml which developer start merging into.

oh-satyo-iswara avatar Oct 06 '22 14:10 oh-satyo-iswara