When Apex class .cls and .cls-meta.xml file names do not match, CLI push will fail with the following error:
ERROR running force:source:push: Cannot read property 'success' of undefined
sfdx force:org:create -s -a demo -f config/project-scratch-def.json
cd demo
sfdx force:apex:class:create -n Demo -d force-app/main/default/classes
mv force-app/main/default/classes/Hello.cls force-app/main/default/classes/HelloFAIL.cls
sfdx force:source:push
We should get a clear error message telling us that the Apex file names do not match.
sfdx force:source:push command fails with:
ERROR running force:source:push: Cannot read property 'success' of undefined
I could reproduce the issue on the release and prerelease of the CLI.
Same thing happens when .cls-meta.xml is missing
I have a fix for this in review and assuming everything checks out it will be included in the release this Saturday. Thanks @pozil
This is now fixed with CLI version 7.76.1 and salesforcedx plugin version 50.1.1
Most helpful comment
I have a fix for this in review and assuming everything checks out it will be included in the release this Saturday. Thanks @pozil