akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

No NULL check after FindOneBy could throw an Exception #11094

Closed Thijzer closed 4 years ago

Thijzer commented 4 years ago

https://github.com/akeneo/pim-community-dev/blob/6ecf7ea9ca0ed35d9f94620c5f9405830f2892a9/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php#L159-L160

[2019-11-20 10:51:39] console.ERROR: Error thrown while running command "akeneo:batch:job csv_export_products 126 --env=prod --email='sysadmin@induxx.be'". Message: "Argument 1 passed to Akeneo\Tool\Bundle\ClassificationBundle\Doctrine\ORM\Repository\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\Tool\Component\Classification\Model\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160" {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Akeneo\\Tool\\Bundle\\ClassificationBundle\\Doctrine\\ORM\\Repository\\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\\Tool\\Component\\Classification\\Model\\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160 at /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Tool/Bundle/ClassificationBundle/Doctrine/ORM/Repository/CategoryRepository.php:140)","command":"akeneo:batch:job csv_export_products 126 --env=prod --email='sysadmin@induxx.be'","message":"Argument 1 passed to Akeneo\\Tool\\Bundle\\ClassificationBundle\\Doctrine\\ORM\\Repository\\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\\Tool\\Component\\Classification\\Model\\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160"} []

Version:CE 3.0.38

Doodoune commented 4 years ago

Hi @Thijzer, Could you describe about the error that you qualify and send us steps to reproduce it on a local environment?

Regards,

Thijzer commented 4 years ago

Here is the error

[2019-11-20 10:51:39] console.ERROR: Error thrown while running command "akeneo:batch:job csv_export_products 126 --env=prod --email='sysadmin@induxx.be'". Message: "Argument 1 passed to Akeneo\Tool\Bundle\ClassificationBundle\Doctrine\ORM\Repository\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\Tool\Component\Classification\Model\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160" {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Akeneo\\Tool\\Bundle\\ClassificationBundle\\Doctrine\\ORM\\Repository\\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\\Tool\\Component\\Classification\\Model\\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160 at /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Tool/Bundle/ClassificationBundle/Doctrine/ORM/Repository/CategoryRepository.php:140)","command":"akeneo:batch:job csv_export_products 126 --env=prod --email='sysadmin@induxx.be'","message":"Argument 1 passed to Akeneo\\Tool\\Bundle\\ClassificationBundle\\Doctrine\\ORM\\Repository\\CategoryRepository::getAllChildrenCodes() must implement interface Akeneo\\Tool\\Component\\Classification\\Model\\CategoryInterface, null given, called in /var/www/akeneo/vendor/akeneo/pim-community-dev/src/Akeneo/Pim/Enrichment/Bundle/Elasticsearch/Filter/Field/CategoryFilter.php on line 160"} []

Version:CE 3.0.38

How to reproduce this error is unknown to me. It was reported and found when triggering a product export csv_export_products.

All I can say is that this customer heavily relies on import profiles and scripting which makes it harder to debug.

Thijzer commented 4 years ago

I just solved the issue by editing the export profiles category selection to all. It might be that we had a code in the Job parameters that was removed.

These persisted parameters with code references can get out of sync.

Doodoune commented 4 years ago

Thanks for sharing the way to solve the issue with us!

I closed this issue, feel free to reopen it if needed.

Regards,