magemojo / m2-ce-cron

Magento 2 cron project to fix bugs and common cron issues.
https://magemojo.com
MIT License
165 stars 45 forks source link

main.ERROR: Consumer is not declared. #97

Closed chris102948 closed 3 years ago

chris102948 commented 4 years ago

Thank you for the nice extension. The reason for us to install this extension is that the consumer cron in Magento is having some bugs so crons will keep looping. We just installed the extension but in the system.log we are facing these erros:

`[2020-06-13 11:03:37] main.ERROR: Consumer 'sales_send_order_invoice_emails' is not declared.

0 /data/web/magento2/vendor/magento/framework-message-queue/ConsumerFactory.php(65): Magento\Framework\MessageQueue\Consumer\Config->getConsumer('sales_send_orde...')

1 /data/web/magento2/vendor/magento/module-message-queue/Console/StartConsumerCommand.php(93): Magento\Framework\MessageQueue\ConsumerFactory->get('sales_send_orde...', 0)

2 /data/web/magento2/vendor/symfony/console/Command/Command.php(255): Magento\MessageQueue\Console\StartConsumerCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

3 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

4 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->___callParent('run', Array)

5 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->Magento\Framework\Interception{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

6 /data/web/magento2/generated/code/Magento/MessageQueue/Console/StartConsumerCommand/Interceptor.php(26): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->___callPlugins('run', Array, Array)

7 /data/web/magento2/generated/code/Magento/MessageQueue/Console/StartConsumerCommand/Proxy.php(143): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

8 /data/web/magento2/vendor/symfony/console/Application.php(893): Magento\MessageQueue\Console\StartConsumerCommand\Proxy->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

9 /data/web/magento2/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Magento\MessageQueue\Console\StartConsumerCommand\Proxy), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

10 /data/web/magento2/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

11 /data/web/magento2/vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

12 /data/web/magento2/bin/magento(23): Symfony\Component\Console\Application->run()

13 {main} [] []`

The same error is appearing for all other consumer cron jobs. Do you have any possible solution for this?

gnuzealot commented 4 years ago

@GetMagented that is the job itself throwing the error. It looks like you might be missing the database table sales_send_order_invoice_emails based off the message.

SeanWahoo commented 4 years ago

Same here. All consumer crons are stating consumer is not delcared.

hotcacao commented 4 years ago

@GetMagented that is the job itself throwing the error. It looks like you might be missing the database table sales_send_order_invoice_emails based off the message.

I also have this issue. The cron schedules are marked as success with similar messages like "Consumer 'sales_send_order_invoice_emails' is not declared.".

Then I disable module MageMojo_Cron to switch back to built-in cron function of magento. It works successfully without any messages. So I guess this is not failure due to missing tables.

Could you give me hints for this situation?

Below are the stacktrace:

[2020-06-16 03:43:07] main.ERROR: Consumer 'sales_send_order_creditmemo_emails' is not declared.
#0 /var/www/webroot/ROOT/vendor/magento/framework-message-queue/ConsumerFactory.php(65): Magento\Framework\MessageQueue\Consumer\Config->getConsumer('sales_send_orde...')
#1 /var/www/webroot/ROOT/vendor/magento/module-message-queue/Console/StartConsumerCommand.php(93): Magento\Framework\MessageQueue\ConsumerFactory->get('sales_send_orde...', 0)
#2 /var/www/webroot/ROOT/vendor/symfony/console/Command/Command.php(255): Magento\MessageQueue\Console\StartConsumerCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/webroot/ROOT/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/webroot/ROOT/vendor/magento/framework/Interception/Interceptor.php(138): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->___callParent('run', Array)
#5 /var/www/webroot/ROOT/vendor/magento/framework/Interception/Interceptor.php(153): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/webroot/ROOT/generated/code/Magento/MessageQueue/Console/StartConsumerCommand/Interceptor.php(26): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->___callPlugins('run', Array, Array)
#7 /var/www/webroot/ROOT/generated/code/Magento/MessageQueue/Console/StartConsumerCommand/Proxy.php(143): Magento\MessageQueue\Console\StartConsumerCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/webroot/ROOT/vendor/symfony/console/Application.php(893): Magento\MessageQueue\Console\StartConsumerCommand\Proxy->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/webroot/ROOT/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Magento\MessageQueue\Console\StartConsumerCommand\Proxy), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/webroot/ROOT/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/webroot/ROOT/vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/webroot/ROOT/bin/magento(23): Symfony\Component\Console\Application->run()
#13 {main} [] []
chris102948 commented 4 years ago

@GetMagented that is the job itself throwing the error. It looks like you might be missing the database table sales_send_order_invoice_emails based off the message.

I'm not so sure because this is not supposed to be any table as far as I know. The error is not only for this consumer, other consumers will give the same error. For me, a temporary workaround is disabling the extension and installing Kiwi_CronScheduler extension to get more insights in the cron jobs and their groups. After that, split your crobtab in parts, based on the cron groups:

Note: you will have to alter this crons to your own situation.

gnuzealot commented 4 years ago

@GetMagented this should be fixed in the latest release

0franco commented 4 years ago

Hello @gnuzealot, I can confirm the error persist on v1.3.4

chris102948 commented 4 years ago

@GetMagented this should be fixed in the latest release

I've updated extension and the error is gone. however after installing newest version I get this error instead:

`[2020-06-22 08:18:17] main.ERROR: Notice: Undefined variable: cmd in /data/web/magento2/vendor/magemojo/m2-ce-cron/Model/Schedule.php on line 531

0 /data/web/magento2/vendor/magemojo/m2-ce-cron/Model/Schedule.php(531): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined varia...', '/data/web/magen...', 531, Array)

1 /data/web/magento2/vendor/magemojo/m2-ce-cron/Model/Schedule.php(346): MageMojo\Cron\Model\Schedule->service()

2 /data/web/magento2/generated/code/MageMojo/Cron/Model/Schedule/Proxy.php(199): MageMojo\Cron\Model\Schedule->execute()

3 /data/web/magento2/vendor/magemojo/m2-ce-cron/Console/Command/CronCommand.php(75): MageMojo\Cron\Model\Schedule\Proxy->execute()

4 /data/web/magento2/vendor/symfony/console/Command/Command.php(255): MageMojo\Cron\Console\Command\CronCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

5 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

6 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(138): MageMojo\Cron\Console\Command\CronCommand\Interceptor->___callParent('run', Array)

7 /data/web/magento2/vendor/magento/framework/Interception/Interceptor.php(153): MageMojo\Cron\Console\Command\CronCommand\Interceptor->Magento\Framework\Interception{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

8 /data/web/magento2/generated/code/MageMojo/Cron/Console/Command/CronCommand/Interceptor.php(26): MageMojo\Cron\Console\Command\CronCommand\Interceptor->___callPlugins('run', Array, Array)

9 /data/web/magento2/vendor/symfony/console/Application.php(893): MageMojo\Cron\Console\Command\CronCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

10 /data/web/magento2/vendor/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(MageMojo\Cron\Console\Command\CronCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

11 /data/web/magento2/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

12 /data/web/magento2/vendor/symfony/console/Application.php(145): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

13 /data/web/magento2/bin/magento(23): Symfony\Component\Console\Application->run()`

gnuzealot commented 3 years ago

This was actually fixed already in this commit

https://github.com/magemojo/m2-ce-cron/commit/f2d709d3#diff-3f6a9bc283080ab26d09d8335bfc1fd39a98cff774e113ca34d02abd97775602R531

joeldavuk commented 2 years ago

Having the same issue on 2.4.3-p1 with it randomly returning one of the consumers is not declared e.g Consumer 'inventory.reservations.cleanup' is not declared.

I have disabled the module and cron runs without error.