akeneo / magento2-connector-community

Akeneo Connector for Magento 2
Open Software License 3.0
83 stars 89 forks source link

Failing product import due to empty family #651

Open kla-at-twoday opened 1 year ago

kla-at-twoday commented 1 year ago

The product import gets stuck on the Create temporary table-step when trying to import product family that is empty (eg. none products attached or none products are passing the completeness setting) in Akeneo. As a result, the product import cron job hangs, without any informative logging of the reason nor proper job cancellation.

Environment and configuration

  1. Adobe Commerce Cloud ver. 2.4.6-p1
  2. Connector ver. 103.4.3
  3. Akeneo ver. CE 6.0.49

Steps to reproduce

  1. Create a product family in Akeneo with none products attached to it.
  2. Import families into Adobe Commerce.
  3. Schedule product import job in Adobe Commerce.

Expected result

  1. The product import job is getting cancelled or skipped for the empty family
  2. The log corresponding to this cron job is informing that the product import was cancelled (skipped) due to none products attached to the family.

Actual result

  1. The product import cron job gets stuck on the Create temporary table-step, blocking the job queue.
marcepartment commented 1 year ago

Found the cause of the problem the function listPerPage doesn't seem to exist and as the code isn't ran if the family isn't empty you would normally not get this error, a temporary solution is to filter the families you want to collect in the configuration of Magento. on line: vendor/akeneo/module-magento2-connector-community/Job/Product.php:520

Error stack: `Next RuntimeException: Error when running a cron job: Call to undefined method Akeneo\Pim\ApiClient\AkeneoPimClient::listPerPage() in /var/www/html/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php:380 Stack trace:

0 /var/www/html/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php(879): Magento\Cron\Observer\ProcessCronQueueObserver->_runJob(1688558040, 1688558044, Array, Object(Magento\Cron\Model\Schedule), 'akeneo_connector')

1 /var/www/html/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php(840): Magento\Cron\Observer\ProcessCronQueueObserver->tryRunJob(1688558040, 1688558044, Array, Object(Magento\Cron\Model\Schedule), 'akeneo_connector')

2 /var/www/html/vendor/magento/module-cron/Observer/ProcessCronQueueObserver.php(280): Magento\Cron\Observer\ProcessCronQueueObserver->processPendingJobs('akeneo_connector', Array, 1688558044)

3 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): Magento\Cron\Observer\ProcessCronQueueObserver->execute(Object(Magento\Framework\Event\Observer))

4 /var/www/html/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Cron\Observer\ProcessCronQueueObserver), Object(Magento\Framework\Event\Observer))

5 /var/www/html/vendor/magento/framework/Event/Manager.php(65): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))

6 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Event\Manager->dispatch('default', Array)

7 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Event\Manager\Interceptor->___callParent('dispatch', Array)

8 /var/www/html/vendor/msp/devtools/Plugin/Event/ManagerInterfacePlugin.php(80): Magento\Framework\Event\Manager\Interceptor->Magento\Framework\Interception{closure}('default', Array)

9 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): MSP\DevTools\Plugin\Event\ManagerInterfacePlugin->aroundDispatch(Object(Magento\Framework\Event\Manager\Interceptor), Object(Closure), 'default', Array)

10 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\Event\Manager\Interceptor->Magento\Framework\Interception{closure}('default', Array)

11 /var/www/html/generated/code/Magento/Framework/Event/Manager/Interceptor.php(23): Magento\Framework\Event\Manager\Interceptor->___callPlugins('dispatch', Array, NULL)

12 /var/www/html/generated/code/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager\Interceptor->dispatch('default', Array)

13 /var/www/html/vendor/magento/framework/App/Cron.php(86): Magento\Framework\Event\Manager\Proxy->dispatch('default')

14 /var/www/html/vendor/magento/module-cron/Console/Command/CronCommand.php(126): Magento\Framework\App\Cron->launch()

15 /var/www/html/vendor/symfony/console/Command/Command.php(298): Magento\Cron\Console\Command\CronCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

16 /var/www/html/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))

17 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cron\Console\Command\CronCommand\Interceptor->___callParent('run', Array)

18 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cron\Console\Command\CronCommand\Interceptor->Magento\Framework\Interception{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

19 /var/www/html/generated/code/Magento/Cron/Console/Command/CronCommand/Interceptor.php(23): Magento\Cron\Console\Command\CronCommand\Interceptor->___callPlugins('run', Array, Array)

20 /var/www/html/vendor/symfony/console/Application.php(1040): Magento\Cron\Console\Command\CronCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

21 /var/www/html/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Cron\Console\Command\CronCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

22 /var/www/html/vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

23 /var/www/html/vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

24 /var/www/html/bin/magento(23): Symfony\Component\Console\Application->run()

25 {main} [] []

`

marcepartment commented 1 year ago

Another solution is to remove all the code that is commented out in the screenshot below. This will make the cron job work again.

Scherm­afbeelding 2023-07-05 om 14 23 40