elasticsuite icon indicating copy to clipboard operation
elasticsuite copied to clipboard

Error during installation on Magento >=2.4.1

Open mrudolph-dotsource opened this issue 3 years ago • 4 comments

Preconditions

I develop in a Docker environment including Elasticsearch 7.7.1, Redis 6, PHP 7.4 and MariaDB 10.4

Magento Version : 2.4.2 EE (tested in 2.4.0 EE, 2.4.1 CE and 2.4.1 EE, too) ElasticSuite Version : 2.10.3 Environment : Developer

Third party modules :

  • "cweagans/composer-patches": "^1.7"
  • "magento/magento-coding-standard": "^6.0"
  • "phpunit/phpunit": "~9.2.0"

Steps to reproduce

  1. composer require smile/elasticsuite
  2. bin/magento module:enable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteSwatches Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteVirtualCategory Smile_ElasticsuiteThesaurus Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker Smile_ElasticsuiteAnalytics Smile_ElasticsuiteAdminNotification
  3. bin/magento setup:config:set --es-hosts elasticsearch:9200
  4. bin/magento setup:config:set --es-enable-ssl 0
  5. bin/magento setup:upgrade

Expected result

  1. No errors and a clean execution of the command setup:upgrade.

Actual result

  1. Cache types config flushed successfully Cache cleared successfully File system cleanup: /var/www/default/generated/code/Composer /var/www/default/generated/code/Fastly /var/www/default/generated/code/Magento /var/www/default/generated/code/PayPal /var/www/default/generated/code/Psr /var/www/default/generated/code/Smile /var/www/default/generated/code/Symfony The directory '/var/www/default/generated/metadata/' doesn't exist - skipping cleanup Updating modules: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.smile_virtualcategory_catalog_category_product_position' doesn't exist, query was: CREATE TRIGGER trg_smile_virtualctgr_cat_ctgr_prd_position_after_insert AFTER INSERT ON smile_virtualcategory_catalog_category_product_position FOR EACH ROW BEGIN INSERT IGNORE INTO ``catalogsearch_fulltext_cl`` (``entity_id``) VALUES (NEW.``product_id``); END
  2. If you run setup: upgrade again after this error, it will go through without errors. However, the trigger is then not created in the table.

mrudolph-dotsource avatar Apr 29 '21 08:04 mrudolph-dotsource

I have the same issue. I followed the installation instructions page but it's more than 1 year old, I'm wondering if it's missing something from the most recent version of ElasticSuite. Anyway trying to use the module ignoring that error eventually I get issues in the category page in the backend "catalog_product index does not exist yet. Make sure everything is reindexed." [edit: the search engine was reverted back to elasticsearch7 instead of elasticsuite, changing that the category page works] And trying to reindex some indexes fail with "Port must be configured within host parameter", mainly because the database crashes. So I'm not sure what could be wrong.

ganeddact avatar Apr 29 '21 09:04 ganeddact

It looks like the Magento Mview mechanism is trying to create triggers before the table is really created.

Did you give a try to :

  • set indexers to "update on save"
  • do the setup:upgrade
  • set indexers back to "update on schedule", which should create the appropriate triggers

It might be a workaround for now, until searching for additional insights

romainruaud avatar Apr 29 '21 11:04 romainruaud

It looks like the Magento Mview mechanism is trying to create triggers before the table is really created.

Did you give a try to :

  • set indexers to "update on save"
  • do the setup:upgrade
  • set indexers back to "update on schedule", which should create the appropriate triggers

It might be a workaround for now, until searching for additional insights

@romainruaud That works for me. But it would be nice if you didn't need this step.

mrudolph-dotsource avatar Apr 29 '21 13:04 mrudolph-dotsource

I would suggest moving all table information to db_schema.xml, and removing setup scripts.

aligent-lturner avatar May 12 '21 01:05 aligent-lturner

Fixed on master. Will be part of next major release 2.11.0

romainruaud avatar Feb 22 '23 00:02 romainruaud

@romainruaud please can you share some details about how this is being fixed? I understood this is a bug in Magento (with a fix in https://github.com/magento/magento2/pull/33092). I can't easily see any pull requests or commits that reference this issue.

fredden avatar Feb 22 '23 09:02 fredden

On master all the tables creations have been moved to db_schema.xml

As suggested per @pykettk and done in https://github.com/Smile-SA/elasticsuite/pull/2148

This is supposed to fix this issue.

romainruaud avatar Feb 22 '23 10:02 romainruaud

Any workaround for Magento < 2.4.6? This fix won't be backported to 2.10.x if I understand correctly? We're planning to deploy ElasticSuite with Magento 2.4.5 and then upgrade to 2.4.6 in a second phase, but we hit this bug and it's kinda nogo :(

xi-ao avatar Aug 22 '23 12:08 xi-ao

@xi-ao you can back-port https://github.com/magento/magento2/pull/33092

fredden avatar Aug 22 '23 12:08 fredden

Hi @romainruaud,

FYI: We installed Elastic Suite 2.11.3.2 on Magento Open Source 2.4.6-p2, and we still got the error on running bin/magento setup:upgrade if the indexers are set to "Update on Schedule".

When applying https://github.com/magento/magento2/pull/33092/files using a Composer patch, the upgrade finishes and the trigger can be found in the database:

smile-elasticsuite-trigger

mzeis avatar Aug 29 '23 05:08 mzeis

Well seems we have to wait for 2.4.7 then :D

thomas-kl1 avatar Feb 28 '24 16:02 thomas-kl1