ergonode / integration-shopware

3 stars 0 forks source link

Category attribute synchronization issue #6

Open sakej opened 1 week ago

sakej commented 1 week ago

Hi. I'm testing the plugin and found this.

Docker Instalation

SW 6.6.6.0 Plugin 3.0.1 PHP 8.3 "org.opencontainers.image.ref.name": "ubuntu", "org.opencontainers.image.version": "22.04", "title": "Dockware play:6.6.6.0", "version": "1.7.0"

Mapping: image

Data: image

The issue:

Log:

Error while persisting category sync. {"message":"There are 1 error(s) while writing data.\n\n1. [/9/translations/2fbb5fe2e29a4d70aa5854ce7ce3e20b/internalLink] The string \"test3\" is not a valid uuid.","file":"/var/www/html/vendor/shopware/core/Framework/DataAbstractionLayer/Write/WriteContext.php:43","trace":"#0 /var/www/html/vendor/shopware/core/Framework/DataAbstractionLayer/Write/WriteContext.php(79): Shopware\\Core\\Framework\\DataAbstractionLayer\\Write\\WriteContext->__construct()\n#1 /var/www/html/vendor/shopware/core/Framework/DataAbstractionLayer/EntityRepository.php(107): Shopware\\Core\\Framework\\DataAbstractionLayer\\Write\\WriteContext::createFromContext()\n#2 /var/www/html/custom/plugins/ErgonodeIntegrationShopware/src/Persistor/CategoryAttributesPersistor.php(78): Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityRepository->upsert()\n#3 /var/www/html/custom/plugins/ErgonodeIntegrationShopware/src/Processor/CategoryAttributesSyncProcessor.php(81): Ergonode\\IntegrationShopware\\Persistor\\CategoryAttributesPersistor->persistCategoryAttributes()\n#4 /var/www/html/custom/plugins/ErgonodeIntegrationShopware/src/MessageQueue/Handler/CategoryAttributeSyncHandler.php(67): Ergonode\\IntegrationShopware\\Processor\\CategoryAttributesSyncProcessor->processStream()\n#5 /var/www/html/custom/plugins/ErgonodeIntegrationShopware/src/MessageQueue/Handler/AbstractSyncHandler.php(50): Ergonode\\IntegrationShopware\\MessageQueue\\Handler\\CategoryAttributeSyncHandler->runSync()\n#6 /var/www/html/custom/plugins/ErgonodeIntegrationShopware/src/MessageQueue/Handler/CategoryAttributeSyncHandler.php(44): Ergonode\\IntegrationShopware\\MessageQueue\\Handler\\AbstractSyncHandler->handleMessage()\n#7 /var/www/html/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(152): Ergonode\\IntegrationShopware\\MessageQueue\\Handler\\CategoryAttributeSyncHandler->__invoke()\n#8 /var/www/html/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(91): Symfony\\Component\\Messenger\\Middleware\\HandleMessageMiddleware->callHandler()\n#9 /var/www/html/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\\Component\\Messenger\\Middleware\\HandleMessageMiddleware->handle()\n#10 /var/www/html/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\\Component\\Messenger\\Middleware\\SendMessageMiddleware->handle()\n#11 /var/www/html/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(68): Symfony\\Component\\Messenger\\Middleware\\FailedMessageProcessingMiddleware->handle()\n#12 /var/www/html/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\\Component\\Messenger\\Middleware\\DispatchAfterCurrentBusMiddleware->handle()\n#13 /var/www/html/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(35): Symfony\\Component\\Messenger\\Middleware\\RejectRedeliveredMessageMiddleware->handle()\n#14 /var/www/html/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(36): Symfony\\Component\\Messenger\\Middleware\\AddBusNameStampMiddleware->handle()\n#15 /var/www/html/vendor/symfony/messenger/MessageBus.php(70): Symfony\\Component\\Messenger\\Middleware\\TraceableMiddleware->handle()\n#16 /var/www/html/vendor/shopware/core/Framework/Adapter/Messenger/MessageBus.php(59): Symfony\\Component\\Messenger\\MessageBus->dispatch()\n#17 /var/www/html/vendor/symfony/messenger/Worker.php(162): Shopware\\Core\\Framework\\Adapter\\Messenger\\MessageBus->dispatch()\n#18 /var/www/html/vendor/symfony/messenger/Worker.php(109): Symfony\\Component\\Messenger\\Worker->handleMessage()\n#19 /var/www/html/vendor/shopware/core/Framework/MessageQueue/Api/ConsumeMessagesController.php(80): Symfony\\Component\\Messenger\\Worker->run()\n#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Shopware\\Core\\Framework\\MessageQueue\\Api\\ConsumeMessagesController->consumeMessages()\n#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()\n#22 /var/www/html/vendor/shopware/core/Framework/Adapter/Kernel/HttpKernel.php(58): Symfony\\Component\\HttpKernel\\HttpKernel->handle()\n#23 /var/www/html/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(86): Shopware\\Core\\Framework\\Adapter\\Kernel\\HttpKernel->handle()\n#24 /var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php(460): Symfony\\Component\\HttpKernel\\HttpCache\\SubRequestHandler::handle()\n#25 /var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php(262): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->forward()\n#26 /var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php(276): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->pass()\n#27 /var/www/html/vendor/symfony/http-kernel/HttpCache/HttpCache.php(202): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->invalidate()\n#28 /var/www/html/vendor/shopware/core/Framework/Adapter/Kernel/HttpCacheKernel.php(65): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->handle()\n#29 /var/www/html/vendor/shopware/core/Kernel.php(117): Shopware\\Core\\Framework\\Adapter\\Kernel\\HttpCacheKernel->handle()\n#30 /var/www/html/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Shopware\\Core\\Kernel->handle()\n#31 /var/www/html/vendor/autoload_runtime.php(29): Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner->run()\n#32 /var/www/html/public/index.php(11): require_once('...')\n#33 {main}"} {"syncHistoryId":"0191d6d4a61f73a6b72df388b687de22"}

thijsMemoICT commented 1 week ago

@sakej thank you for your detailed explanation.

The issue you are encountering is that there is text in the internalLink field instead of an UUID. The internalLink in Shopware is a reference to a product, category or landing page and should contain only the UUID of that page. So the type hint in the mapping is a bit confusing, as it says text, but it should be a UUID but that is being send as a string/text.

That all other categories their attributes aren't update when there is an error like this, is known. This is happening because of that upsert is being used to update the data in Shopware. When using upsert you can pass multiple objects to be updated, but when one triggers an error all will fail to update.