sfdx – second generation packages – push custom fields fails silently

I have setup three sfdx second gen packages, each with their own sub folder in my umbrella project folder.

Package 1 defines some Custom Objects.

Package 2 adds some custom fields to the custom objects created by Package 1.

Package 3 holds nothing at the moment.

My sfdx-project.json lists Package 1 as a dependency for Package 2.

When I do a sfdx force:source:push it appears to successfully deploy, but the fields in the org defined by Package 2 are missing. If I change my sfdx-project.json file to list only Package 2, without any dependencies, and clear out my .sfdx/org subfolder, a sfdx force:org:push results in the following errors for my custom fields:

N/A           An object 'TP_Transaction__c.TX_VP_BillingEmail__c' of type CustomField was named in package.xml, but was not found in zipped direc
tory

There a multiple errors as above, for each custom field defined in Package 2. The initial push with the full project configuration also listed the fields from Package 2 as added.

Based on the error above it looks like the sfdx cli is creating a MDAPI package.xml correctly listing the custom fields, but not including the old MDAPI CustomObject XML including the fields.

Has anyone else worked around this? Any suggestions for next steps to troubleshoot?

I want to keep our data model fields coupled to the domain that deals with them. This doesn’t seem possible currently.

Answer

This is an unlisted known issue with sfdx. I created a git repository to reproduce the issue and reported it to SFDC in a case; https://github.com/JonnyPower/sfdx-push-bug-20190124

I received the following response on my case:

Our engineers are aware of this and are working to find a solution to fix it.

However we do not have an ETA on the fix yet. Currently the only workaround is what you have already mentioned; performing separate push for the different packages.

I asked for this to be reported as a known issue under Salesforce DX and am awaiting a further response.

Attribution
Source : Link , Question Author : Jonny Power , Answer Author : Jonny Power

Leave a Comment