cli icon indicating copy to clipboard operation
cli copied to clipboard

ERROR running force:mdapi:convert: Maximum call stack size exceeded

Open tsofindavid opened this issue 2 years ago • 2 comments

Summary

I'm using sfdx to convert mdapi to source format.

Steps To Reproduce:

1.Clone test source data here https://github.com/tsofindavid/sfdx-issue/tree/main. 2.Run sfdx force:mdapi:convert --dev-debug -r ./path_to_sourceFolder

Expected result

Successfully result without error.

Actual result

ERROR running force:mdapi:convert: Maximum call stack size exceeded

Additional information

This problem not reproduce on OS Windows.

System Information

  • Linux(ubuntu) terminal.
  • SFDX Verssion: sfdx-cli/7.166.1 linux-x64 node-v16.15.0

image image image

tsofindavid avatar Sep 05 '22 15:09 tsofindavid

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.

github-actions[bot] avatar Sep 05 '22 15:09 github-actions[bot]

I understood what the problem is. You have the SWITCH module to enable debug logs. And this module, if the command has --dev-debug, will set env DEBUG = "". In my case I am using sfdx-cli in child process and my server app has the same node-debug module and I am using the same env DEBUG="my-app" value. As a result, we only got my logs, because the DEBUG value has my key, but sfdx started sending logs like this { sfdx force:mdapi:convert } &> /dev/null. And that's okay. But now I have disabled all debug logs in my application and this is a very bad case.

tsofindavid avatar Sep 06 '22 14:09 tsofindavid

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

git2gus[bot] avatar Oct 19 '22 16:10 git2gus[bot]

Hey, sorry for the late reply 👋🏼

I remember seeing this with another command, I haven't reproduced with force:mdapi:convert from the logs it's seems it's the same cause:

the base command class used in the sfdx commands tries to pass a huge array to node-bunyan which then crashes:

https://github.com/salesforcecli/command/blob/main/src/ux.ts#L317 https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L1036

Over the coming weeks there will be some improvements to the CLI which might fix this so I'll leave the issue open until I can test it.

See: https://developer.salesforce.com/blogs/2022/12/big-improvements-coming-to-the-salesforce-cli

cristiand391 avatar Jan 03 '23 20:01 cristiand391