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

Cannot read property 'addChild' of undefined #1261

Closed
abhishekdepro opened this issue Oct 31, 2021 · 10 comments
Closed

Cannot read property 'addChild' of undefined #1261

abhishekdepro opened this issue Oct 31, 2021 · 10 comments
Labels
bug Issue or pull request that identifies or fixes a bug

Comments

@abhishekdepro
Copy link

Whenever we try to retrieve any component from Org Browser or through sfdx:retrieve the following error occurs. This started just last week:

Starting SFDX: Retrieve Source from Org
Cannot read property 'addChild' of undefined

CLI version: sfdx-cli/7.115.1 win32-x64 node-v14.17.5

@mshanemc mshanemc added the more information required Issue requires more information or a response from the customer label Nov 1, 2021
@WillieRuemmele
Copy link
Member

Hi @abhishekdepro, can you please try upgrading to the latest version of the CLI 7.124.0 and try again?

@abhishekdepro
Copy link
Author

Hi @WillieRuemmele , yes upgraded and same issue still remains.

@no-response no-response bot removed the more information required Issue requires more information or a response from the customer label Nov 1, 2021
@WillieRuemmele
Copy link
Member

Can you please provide the following information

  • sfdx version --verbose
  • run the retrieve command with --dev-debug and provide just the stack trace
  • steps to reproduce
    • how to create any certain metadata types
    • any setup steps in the UI
    • if possible, a link to a repo we can clone and reproduce the problem with

@abhishekdepro
Copy link
Author

Sure @WillieRuemmele.

CLI Version :
sfdx-cli/7.124.0

Architecture:
win32-x64

Node Version :
node-v14.18.1

Plugin Version:
@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.3 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.10.1 (core)
@oclif/plugin-update 1.5.0 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
alias 1.1.22 (core)
apex 0.3.0 (core)
auth 1.7.4 (core)
config 1.2.41 (core)
custom-metadata 1.0.12 (core)
data 0.6.3 (core)
generator 1.2.0 (core)
limits 1.2.2 (core)
org 1.8.4 (core)
salesforce-alm 53.1.1 (core)
schema 1.0.10 (core)
sfdx-cli 7.124.0 (core)
source 1.2.5 (core)
telemetry 1.2.8 (core)
templates 52.4.0 (core)
trust 1.0.8 (core)
user 1.5.2 (core)

OS and Version:
Windows_NT 10.0.19042

Stack trace:

ERROR running force:source:retrieve: Cannot read property 'addChild' of undefined
*** Internal Diagnostic ***

TypeError: Cannot read property 'addChild' of undefined
at Object.getTraversalObj (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules\fast-xml-parser\src\xmlstr2xmlnode.js:300:23)
at Proxy.exports.parse (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules\fast-xml-parser\src\parser.js:19:39)
at SourceComponent.parse (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\resolve\sourceComponent.js:168:42)
at SourceComponent.parseXmlSync (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\resolve\sourceComponent.js:99:25)
at SourceComponent.getNonDecomposedChildren (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\resolve\sourceComponent.js:206:29)
at SourceComponent.getChildren (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\resolve\sourceComponent.js:72:24)
at ComponentSet.getObject (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\collections\componentSet.js:231:42)
at MetadataApiRetrieve. (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\client\metadataApiRetrieve.js:143:45)
at Generator.next ()
at fulfilled (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\source-deploy-retrieve\lib\src\client\metadataApiRetrieve.js:5:58)
Outer stack:
at Function.wrap (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\command\node_modules@salesforce\core\lib\sfdxError.js:171:27)
at Retrieve.catch (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\command\lib\sfdxCommand.js:248:67)
at async Retrieve._run (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@salesforce\command\lib\sfdxCommand.js:85:13)
at async Config.runCommand (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@oclif\config\lib\config.js:173:24)
at async SfdxMain.run (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@oclif\command\lib\main.js:27:9)
at async SfdxMain._run (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\node_modules@oclif\command\lib\command.js:43:20)
at async Object.run (C:\Users\DEYAX7\AppData\Local\sfdx\client\7.124.0-0a64b63\dist\cli.js:162:47)


Steps to reproduce:
Happens whenever trying to retrieve custom labels, custom field, etc.

Sorry cannot share the repo as I'm working on my client's project.

@WillieRuemmele WillieRuemmele added the bug Issue or pull request that identifies or fixes a bug label Nov 1, 2021
@WillieRuemmele
Copy link
Member

From your stack trace, it looks like the xml parser library we're using fast-xml-parser is throwing an error. I would ensure that all of your xml files are valid. You could try breaking down your deployment into smaller individual deploys to narrow down which file is causing the issue. Until we're able to consistently reproduce this issue we'll have a hard time fixing it

@abhishekdepro
Copy link
Author

Thanks @WillieRuemmele ! Worked like a charm.

There was a problem with the closing tag in custom labels which caused the issue.

However, it'd be great if the CLI can throw us the actual file parsing exception or on which xml file the exception occurred.

@WillieRuemmele WillieRuemmele added bug Issue or pull request that identifies or fixes a bug and removed bug Issue or pull request that identifies or fixes a bug labels Nov 2, 2021
@uip-robot-zz
Copy link

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

@WillieRuemmele
Copy link
Member

I agree, I've created that bug and we'll be adding that in the future. Thank you again 🎉

@shetzel
Copy link
Contributor

shetzel commented Jan 13, 2022

The fix is in the latest CLI release just published. sfdx version 7.133.0

@abhishekdepro
Copy link
Author

Thanks so much! Appreciate all the great work the SFDX team is doing.

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

5 participants