Console not working after converting to Composer on 4.2

Your software
My Mautic version is: 4.2.0
My PHP version is: 7.4
My Database type and version is: 10.3.34-MariaDB

Your problem
My problem is: After following the documentation to convert to Composer, the console/cli/crons are no longer working. Campaign events aren’t triggering, emails aren’t sending, can’t process the 4.2.1 update from the CLI, etc.

These errors are showing in the log:
[31-Mar-2022 13:15:20 UTC] PHP Warning: require_once(/[PATH-TO-MAUTIC]/bin/…/app/autoload.php): failed to open stream: No such file or directory in /home/proctor360/mautic.proctor360.com/bin/console on line 21
[31-Mar-2022 13:15:20 UTC] PHP Fatal error: require_once(): Failed opening required ‘/[PATH-TO-MAUTIC]/bin/…/app/autoload.php’ (include_path=’.:/opt/cpanel/ea-php74/root/usr/share/pear’) in /home/proctor360/mautic.proctor360.com/bin/console on line 21

Steps I have tried to fix the problem:

After converting to composer, I see that there is nothing in the /[PATH-TO-MAUTIC]/app – it’s all in /[PATH-TO-MAUTIC]/docroot/app but console is still in /[PATH-TO-MAUTIC]/bin I’ve only moved the files that the documentation said to move, so I’m hesitant to try moving files around just by guessing.

I’ve run “composer update” but that hasn’t changed anything.

For anyone else experiencing this issue, it looks like it’s a break that was released in 4.2. The composer conversion does not work as documented. I got some help from Mautic’s slack #composer channel and was directed to this issue on Github which has a temporary fix:

After applying the patch described in the link above, I ran composer update from the mautic root folder and now console is working. However, if I run composer update again to try to upgrade to 4.2.1, the upgrade does not seem to take place. Still seem to be running 4.2.0

So to recap, to temporarily restore console after composer conversion:

  1. Apply the patch
  2. Run “composer update” ONCE
  3. Don’t run “composer update” again or console will quit working again.
  4. Wait for Mautic to release an official fix.