Elasticsuite: After upgrade to magento 2.3.2 site broken

Created on 26 Jun 2019  路  28Comments  路  Source: Smile-SA/elasticsuite

Preconditions


Magento Version : magento 2.3.2


ElasticSuite Version :2.8.0


Environment :Developer


Third party modules :

Steps to reproduce

  1. composer require "magento/magento-cloud-metapackage":"2.3.2" --no-update
  2. bin/magento setup:upgrade
  3. 500 error Fatal Error: 'Class 'Magento\CatalogInventory\Model\Plugin\Layer' not found' in '/var/www/vhosts/default/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php' on line 25

Expected result

  1. can normally go to home page

Actual result

<error>
<messages>
<error>
<data_item>
<code>500</code>
<message>
<![CDATA[
Fatal Error: 'Class 'Magento\CatalogInventory\Model\Plugin\Layer' not found' in '/var/www/vhosts/default/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php' on line 25
]]>
</message>
<trace>
<![CDATA[ Trace is not available. ]]>
</trace>
</data_item>
</error>
</messages>
</error>

image

bug

Most helpful comment

@skazhikadyadya I fix like this;

$ composer remove smile/elasticsuite 
$ composer require smile/elasticsuite 2.8.x-dev

All 28 comments

Same here, as it seems they removed the Layer-plugin entirely from the source:

https://github.com/magento/magento2/tree/2.3.2/app/code/Magento/CatalogInventory/Model/Plugin

A quick fix for this is to disable the plugin, this would have other consequences regarding the displaying of the stock status, but at least the site isn't down:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!--
    Temporary Quick-Fix to prevent the site to be down:
    https://github.com/Smile-SA/elasticsuite/issues/1442
    -->
    <type name="Magento\Catalog\Model\Layer">
        <plugin name="addStockStatusOnPrepareFrontCollection"
                type="Smile\ElasticsuiteCatalog\Plugin\LayerPlugin"
                disabled="true"/>
    </type>
</config>

Created PR that should fix this issue https://github.com/Smile-SA/elasticsuite/pull/1444

Layered navigation will still be entirely broken even if you do this.

Looks like this commit is what removed the layer plugin and changed the logic:

https://github.com/magento/magento2/commit/9ab466d8569ea556cb01393989579c3aac53d9a3#diff-2ad66624cecd33a368d784f2be936f48

Thank you @NathMorgan for your PR.

as far as I can see, it could do the trick. I did not test it by myself however.

@androshchuk can you have a look on this issue and associated PR ?

Regards

Unfortunately #1448 did not work for us and we desperately need to have a working version. When can we expect a fix?

@kleestb did you try to restore the layer plugin ?
https://github.com/Smile-SA/elasticsuite/issues/1445

It's weird, that Magento fellows allowed removal of the code without any prior notice, as pert of minor release.

Same issue

What is the issue you are getting after applying the patch?

Same issue on Vanilla Magento 2.3.2, ES 6.1.8 and Module 2.8.0

did you apply this patch and the #1444 patch as well?!

Hi @southerncomputer, I'll apply the patch and revert further changes that I made in order to solve this. I'll let you know quickly.

@southerncomputer after reindexing (as I said, fresh install, Data Migration has been done, tho):

1 exception(s):
Exception #0 (LogicException): catalog_product index does not exist yet. Make sure everything is reindexed.

did you get this error after doing bin/magento indexer:reindex ?

Yes, exactly. I made some calls to ES to check for active indicies and found only those. The numbers look to small. There are ~6k Products in the DB currently.

 www-data@local:~/magento2$ curl -X GET "elasticsearch:9200/_cat/indices?v"
health status index                                             uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   magento2_product_1_v1                             qBm5TNDLQzi5gTPM-SPxkA   5   1       2932            0      3.4mb          3.4mb
green  open   magento2_default_catalog_category_20190706_140456 ajZESosKRCi4okyFUPbR7A   1   0        680            0        1mb            1mb
green  open   magento2_default_thesaurus_20190706_140458        OWeLSlbSTsqx_DFRreE4Yg   1   0          0            0       261b           261b

It sounds like your product indexing is crashing/getting stuck! Might turn on var/log/debug.log and tail it while its doing indexing!
on my dev box it is showing

green  open   magento2_default_catalog_product_20190706_050716  zsB-28XjRfWbMzG6NfXN8g   1   0   12301172            0     12.4gb         12.4gb

I know elasticsuite builds indexes with a temp name and then renames it as it completes successfully!

p.s. i think magento2_product_1_v1 is created from the built-in elasticsearch not elasticsuite!

Thanks for that hint with the Magento ElasticSearch Engine, that actually was an issue of not setting the Source to ElasticSuite, there should be a check that looks out for correct settings and if not, advises the user to apply correct settings.

So generally, after applying both pathes -> it worked.

Good to know !

I'll work on this one this week.

But for me, the plugin can be removed, since the Stock management is now done with a search context filter :

https://github.com/Smile-SA/elasticsuite/blob/2.8.x/src/module-elasticsuite-catalog/Model/Product/Search/Request/Container/Filter/Stock.php

Fixed by PR #1461

Thanks! Could create a new release with this merge?

A quick fix for this is to disable the plugin, this would have other consequences regarding the displaying of the stock status, but at least the site isn't down:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <!--
    Temporary Quick-Fix to prevent the site to be down:
    https://github.com/Smile-SA/elasticsuite/issues/1442
    -->
    <type name="Magento\Catalog\Model\Layer">
        <plugin name="addStockStatusOnPrepareFrontCollection"
                type="Smile\ElasticsuiteCatalog\Plugin\LayerPlugin"
                disabled="true"/>
    </type>
</config>

Hi, excuse me, how i can implement that XML? Thanks.

Some problem.

[m2@shop public_html]$ bin/magento module:enable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteSwatches Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteVirtualCategory Smile_ElasticsuiteThesaurus Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker
PHP Fatal error:  Class 'Magento\CatalogInventory\Model\Plugin\Layer' not found in /home/mirkada/web/shop.m2.com/public_html/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Plugin/LayerPlugin.php on line 25

Latest M2. How I can quickly fix that? Thanks.

@skazhikadyadya I fix like this;

$ composer remove smile/elasticsuite 
$ composer require smile/elasticsuite 2.8.x-dev

@roman204 as far as I know there is no 3.0 version.

Where did you find it ?

It's elasticsuite here... not magesuite...

@romainruaud
use this
composer require creativestyle/magesuite ^3.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surendiranganesan picture surendiranganesan  路  3Comments

markdimi picture markdimi  路  4Comments

gihovani picture gihovani  路  4Comments

rvitaliy picture rvitaliy  路  3Comments

mokadev picture mokadev  路  3Comments