-
Notifications
You must be signed in to change notification settings - Fork 78
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 with "force:source:convert" command when using latest sfdx cli version #1106
Comments
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. |
We are experiencing a similar issue after the latest update: ERROR running force:source:convert: Component conversion failed: Cannot read property 'id' of undefined |
@allisonarnaud @rasmuszimmer can you share some source in a repo that's failing to convert so we can find the bug? the simplest source that'll reproduce the error is best. If not, any idea what metadata type is failing? |
I'm also seeing this issue. When running I get: And when running with the JSON flag I get:
|
@allisonarnaud @lpbearden could you please check if you see this error if you convert your staticresources folder: If yes, delete the folder |
@jayree I converted all of our staticresources without any issues. |
@lpbearden I had the same error because of some hidden files and folder e.g. |
I looked through the source being converted and found no hidden files, so I don't believe that is our issue. |
Hi @lpbearden do you have a list of different metadata types you're trying to convert? I think there's a single type causing this bug |
@lpbearden - can you open this file /usr/local/lib/node_modules/sfdx-cli/node_modules/@salesforce/source-deploy-retrieve/lib/src/resolve/adapters/decomposedSourceAdapter.js and just before line 77 where it does this: @rasmuszimmer - can you append |
@shetzel I ran the command and the output was quite large, so I just pulled out the names so here's my result of running
|
This would mean it's due to the Account object and I think it means that the code found a child of Account but not the Account component itself in the source. I believe this happens when you're adding fields to an existing standard object. Does this sound correct? |
@shetzel That doesn't seem correct. We have the full Account object. The exact same metadata converts just fine in the previous versions of the CLI. |
The previous versions of the CLI didn't use the source plugin and the SDR library though. So if you try to convert just the Account object it succeeds? To limit the output, can you wrap the |
Just the Account object results in: When adding in the
|
in the same location could you try adding
thank you so much for your help |
Here's the offending piece: So its a layout, and looking at the metadata we don't have an |
@lpbearden - that layout file is in the wrong location within the project. A layout file should be in a |
@shetzel That's really interesting. All of our objects are laid out somewhat like this. Here's an example:
I'm not really sure what led us to this layout originally, but a big reason we switched to Source format 3 years ago was flexibility in grouping and organizing our metadata. I'm assuming the SDR library you mentioned and this most recent version of the CLI have removed this unintended functionality. |
Having the same issue with 7.112.1. In our codebase we have a number of instances where we are adding fields, layouts etc... to a standard object or an object that is part of a managed package. We are not including those in our deployment as we are pushing to a 1st generation managed package. When we run force:source:convert to move from SFDX to Metadata format so it can be pushed to the packaging org into the correct namespace we get the following: ERROR running force:source:convert: Metadata xml file /force-app/main/default/objects/hed__Term__c/hed__Term__c.object-meta.xml is forceignored but is required for/force-app/main/default/objects/hed__Term__c/fields/Add_Term_by_this_Date__c.field-meta.xml Note that *** is a substitution of the full path I did to remove PII from the path. If all the force ignore references to objects are removed we then get: ERROR running force:source:convert: Component conversion failed: Cannot read property 'id' of undefined Adding the debug code into the plug as shown above gives output that it is failing for an object '***/force-app/main/default/objects/hed__Term__c/hed__Term__c.object-meta.xml' All the source for that object holds is the meta file for the object itself and some fields. If the functionality to be able to convert from source to metadata without having the object definition itself has been removed then we are in a difficult position as to be able to automatically add new metadata to a 1st gen package there is no method in source to do so unlike metadata format where you can specify the namespace to install into in the package.xml. |
@pfordey - you are describing a different usecase that we definitely need to support. A field is a valid child of a CustomObject and the CustomObject meta file should not be required to deploy/retrieve. So my proposed solution of throwing if the parent is not found is incorrect. If you don't mind, could you open a new issue with this information along with the typical plugin versions, etc. Thanks! |
@lpbearden - please stand by. That metadata organization (specifically within the custom object dir) would not be as intended but it did happen to work just fine with 7.110.0 and previous versions. You are correct that the SDR (source-deploy-retrieve) library has different interpretation logic for metadata files and relies more on file system hierarchy for better performance and simpler, more maintainable code. |
This issue has been linked to a new work item: W-9720131 |
@lpbearden - We will fix the code to throw a better error message so that it's obvious which component caused the problem and what the solution is to fix it. However, nesting non-CustomObject children within a CustomObject folder was never an intended metadata organizational structure. There are still lots of benefits to source controlling your metadata in source format versus mdapi format, but the new source plugin will not support nested non-CustomObject children like that. I would use a pre 7.112 version of the CLI, restructure the metadata, then upgrade. Apologies for that inconvenience! |
@shetzel the better error is good enough for me. Thanks for digging into this. Hope it wasn't too big of a rabbit hole for us just not following best practice! |
@shetzel sorry I was not able to contribute to the debugging sooner. The previous posts here led me to be able to narrow down to a few instances where some developer had carelessly placed metadata in incorrect folders. First instance was a standard value set placed inside the object folder. When I corrected that I went from "ERROR running force:source:convert: Component conversion failed: Cannot read property 'id' of undefined" after debugging and console.dir in that piece I was able to locate a customfieldtranslation that was put inside the main object translation xml instead of in its own file. I can now convert the full source. Thanks for looking in to this! Edit: |
Same error on deploying, after a fresh install
Is there a workaround for this issue? |
Rolling back to previous version
still produces:
Same with |
@AndrewRayCode im not sure sfdx plugins:install [email protected] actually works and installs a previous version. Can you run sfdx version and confirm? |
We are getting the similar kind of issue recently Version details, The error is, Component conversion failed: Cannot read property 'contentType' of undefined |
@hariss63 - that's a different error. Can you post a new issue with all the details in the template filled out please? We'll need the command and all flags used to produce the error, the stack trace for that error (append |
Summary
Running command "force:source:convert" with latest version of sfdx cli ([email protected]) results in an error:
Steps To Reproduce:
Expected result
Successful deployment
Actual result
Error with "force:source:convert" command failing
Additional information
The same process was used on monday without any issues, pointing towards a potential issue with sfdx version ([email protected]) released yesterday (04/08/21).
The text was updated successfully, but these errors were encountered: