pimcore / ecommerce-framework-bundle

Ecommerce Framework community bundle provides e-commerce functionality such as product listing and filtering, pricing, carts and checkouts for Pimcore.
https://pimcore.com/docs/platform/Ecommerce_Framework/
Other
11 stars 33 forks source link

[Bug]: Attributes are not built yet. Is the service properly configured to set an attribute factory? / Table pimcore/object_store_ef_fd is corrupted. Please drop the table and recreate #55

Closed igor-bel closed 1 year ago

igor-bel commented 1 year ago

Expected behavior

Installation completed.

Actual behavior

ERROR     [pimcore] RuntimeException: Attributes are not built yet. Is the service properly configured to set an attribute factory? in /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/IndexService/Config/AbstractConfig.php:182
Stack trace:
#0 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/IndexService/Worker/AbstractWorker.php(65): Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Config\AbstractConfig->getAttributes()
#1 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/IndexService/IndexService.php(176): Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\Worker\AbstractWorker->getIndexAttributes(true)
#2 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php(53): Pimcore\Bundle\EcommerceFrameworkBundle\IndexService\IndexService->getIndexAttributes(true)
#3 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/CoreExtensions/ClassDefinition/IndexFieldSelectionCombo.php(43): Pimcore\Bundle\EcommerceFrameworkBundle\CoreExtensions\ClassDefinition\IndexFieldSelectionCombo->buildOptions()
#4 /var/www/html/vendor/pimcore/pimcore/models/DataObject/ClassDefinition/Helper/VarExport.php(44): Pimcore\Bundle\EcommerceFrameworkBundle\CoreExtensions\ClassDefinition\IndexFieldSelectionCombo->__construct()
#5 /var/www/html/var/classes/fieldcollections/SimilarityField.php(45): Pimcore\Model\DataObject\ClassDefinition\Data::__set_state(Array)
#6 /var/www/html/vendor/pimcore/pimcore/models/DataObject/Fieldcollection/Definition.php(114): include('/var/www/html/v...')
#7 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/Tools/Installer.php(285): Pimcore\Model\DataObject\Fieldcollection\Definition::getByKey('SimilarityField')
#8 /var/www/html/vendor/pimcore/ecommerce-framework-bundle/src/Tools/Installer.php(170): Pimcore\Bundle\EcommerceFrameworkBundle\Tools\Installer->installFieldCollections()
#9 /var/www/html/vendor/pimcore/pimcore/lib/Extension/Bundle/PimcoreBundleManager.php(334): Pimcore\Bundle\EcommerceFrameworkBundle\Tools\Installer->install()
#10 /var/www/html/vendor/pimcore/pimcore/bundles/CoreBundle/src/Command/Bundle/InstallCommand.php(59): Pimcore\Extension\Bundle\PimcoreBundleManager->install(Object(Pimcore\Bundle\EcommerceFrameworkBundle\PimcoreEcommerceFrameworkBundle))
#11 /var/www/html/vendor/symfony/console/Command/Command.php(312): Pimcore\Bundle\CoreBundle\Command\Bundle\InstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(88): Symfony\Component\Console\Application->doRunCommand(Object(Pimcore\Bundle\CoreBundle\Command\Bundle\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(314): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Pimcore\Bundle\CoreBundle\Command\Bundle\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/vendor/symfony/framework-bundle/Console/Application.php(77): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/symfony/console/Application.php(168): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(54): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
#19 /var/www/html/bin/console(20): require_once('/var/www/html/v...')
#20 {main}
[ERROR] An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1877 Table
         pimcore/object_store_ef_fd is corrupted. Please drop the table and recreate.

Steps to reproduce

  1. Install pimcore/pimcore 11.0.0-RC1.
  2. php composer require pimcore/ecommerce-framework-bundle
  3. In config/bundles.php add PimcoreEcommerceFrameworkBundle::class => ['all' => true],
  4. php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle
mattamon commented 1 year ago

@igor-bel Thank you for this issue. Could you please be more specific with the steps Install pimcore/pimcore 11.0.0-RC1? Did you install the demo or the skeleton version? Did you call pimcore install before calling php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle?

Can you also please check which version of the bundle was installed, since this is not officially released yet? For me it was Installing pimcore/ecommerce-framework-bundle (dev-type_fixes 0225d9d): Extracting archive which is not correct cause require does not work yet.

Thank you!

igor-bel commented 1 year ago

@mattamon Thank you for your response. I downloaded current dev skeleton 11.x zip, did php composer install. It installed v.11.0.0-RC1:

image

Then I performed php vendor/bin/pimcore-install --mysql-host-socket=db --mysql-username=pimcore --mysql-password=pimcore --mysql-database=pimcore and http://localhost/admin worked for me as expected. Then I tried to install php composer require pimcore/ecommerce-framework-bundle:1.x-dev#v1.0.0-RC1 but it failed because of one conflict in 3rd party dependency. I made a fork to https://github.com/igor-bel/ecommerce-framework-bundle/tree/1.x-hotfix, fixed dependency and installed: php composer require pimcore/ecommerce-framework-bundle:1.x-hotfix-dev After that I added in config/bundles.php PimcoreEcommerceFrameworkBundle::class => ['all' => true], and tried php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle which failed for me.

mattamon commented 1 year ago

@igor-bel thank you for the more detailed description!

Could you maybe try to checkout this PR https://github.com/pimcore/ecommerce-framework-bundle/pull/56 or apply it as a patch https://patch-diff.githubusercontent.com/raw/pimcore/ecommerce-framework-bundle/pull/56.patch and check if the installation works as intended?

igor-bel commented 1 year ago

@mattamon I applied the patch, now no stack trace with the error, just after the command php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle appears the error:

[ERROR] An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1877 Table
         pimcore/object_store_ef_fd is corrupted. Please drop the table and recreate.

The table is empty:

create table pimcore.object_query_EF_FD
(
    oo_id                       int unsigned default 0                  not null
        primary key,
    oo_classId                  varchar(50)  default 'EF_FD'            null,
    oo_className                varchar(255) default 'FilterDefinition' null,
    pageLimit                   double                                  null,
    defaultOrderByInheritance   varchar(190)                            null,
    orderByAsc                  longtext                                null,
    orderByDesc                 longtext                                null,
    ajaxReload                  tinyint(1)                              null,
    infiniteScroll              tinyint(1)                              null,
    limitOnFirstLoad            double                                  null,
    conditionsInheritance       varchar(190)                            null,
    filtersInheritance          varchar(190)                            null,
    crossSellingCategory__id    int                                     null,
    crossSellingCategory__type  enum ('document', 'asset', 'object')    null,
    similarityFieldsInheritance varchar(190)                            null,
    constraint fk_object_query_EF_FD__oo_id
        foreign key (oo_id) references pimcore.objects (id)
            on delete cascade
)
    charset = utf8mb4;
mattamon commented 1 year ago

@mattamon I applied the patch, now no stack trace with the error, just after the command php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle appears the error:

[ERROR] An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1877 Table
         pimcore/object_store_ef_fd is corrupted. Please drop the table and recreate.

The table is empty:

create table pimcore.object_query_EF_FD
(
    oo_id                       int unsigned default 0                  not null
        primary key,
    oo_classId                  varchar(50)  default 'EF_FD'            null,
    oo_className                varchar(255) default 'FilterDefinition' null,
    pageLimit                   double                                  null,
    defaultOrderByInheritance   varchar(190)                            null,
    orderByAsc                  longtext                                null,
    orderByDesc                 longtext                                null,
    ajaxReload                  tinyint(1)                              null,
    infiniteScroll              tinyint(1)                              null,
    limitOnFirstLoad            double                                  null,
    conditionsInheritance       varchar(190)                            null,
    filtersInheritance          varchar(190)                            null,
    crossSellingCategory__id    int                                     null,
    crossSellingCategory__type  enum ('document', 'asset', 'object')    null,
    similarityFieldsInheritance varchar(190)                            null,
    constraint fk_object_query_EF_FD__oo_id
        foreign key (oo_id) references pimcore.objects (id)
            on delete cascade
)
    charset = utf8mb4;

Okay this is at least an improvement. Let me check if I get the same error. Maybe you could try to reinstall pimcore as a whole. Maybe this helps.

igor-bel commented 1 year ago

@mattamon I tried to repeat install from a scratch (removed database as well) and got same error at the end. But this time when I am clicking on the table, I am getting same error message like in console:

image

docker-compose exec php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle

image
igor-bel commented 1 year ago

@mattamon And then I had same error for basically all tables like object_store_EF_FD, object_collection_FilterSelectFromMultiSelect_EF_FD, etc... one after another. I tried to drop a table from error message and recreate. Then I found https://github.com/pimcore/demo/blob/11.x/dump/data-0-bootstrap.sql and for me helped to run https://raw.githubusercontent.com/pimcore/demo/11.x/dump/data-0-bootstrap.sql manually.

After that docker-compose exec php bin/console pimcore:bundle:install PimcoreEcommerceFrameworkBundle worked.

mattamon commented 1 year ago

Hmm unfortunately I am not able to reproduce this error. This seems rather strange to me tbh.

igor-bel commented 1 year ago

What I noticed that those object_* tables didn't exist before running installation. When the error appears, the table is created but with not all fields (and having that broken state). If to run in advance that .sql script all tables are there and not changing during install.

mattamon commented 1 year ago

It is because the classes are installed and with the classes, the tables are generated. It's the same if you create a new class in the backend and hit save. So I am a little confused why this would not work. I am giving it to a colleague to see if someone else can reproduce it.

igor-bel commented 1 year ago

Just a note: I am using MariaDB 10.11, maybe this corruption happens on communication layer.

aryaantony92 commented 1 year ago

I also tried installing the ecommerce framework with the fresh skeleton install and it worked for me. And the table is also created successfully.

mattamon commented 1 year ago

Just a note: I am using MariaDB 10.11, maybe this corruption happens on communication layer.

We also updated to 10.11 https://github.com/pimcore/skeleton/blob/11.x/docker-compose.yaml#L7

Does those errors also appear in the backend when you try to e.g. create new filters?