cli
cli copied to clipboard
ERROR running force:mdapi:convert: Maximum call stack size exceeded
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
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.
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.
This issue has been linked to a new work item: W-11933315
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