Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES2.6.7] Invalid scope type 'containers_stores' error in category and search-result pages after updating Magento CE 2.2.7 to 2.2.8 #1361

Closed
lewisje opened this issue Mar 27, 2019 · 8 comments
Assignees

Comments

@lewisje
Copy link

lewisje commented Mar 27, 2019

When I go to a category page or use the site search, I get the error Invalid scope type 'containers_stores'; this does not happen on the home page or on a product page, or in the admin area.

Preconditions

Magento Version : CE 2.2.8

ElasticSuite Version : 2.6.7

Environment : Developer (I first noticed this in the Production site, leading me to temporarily disable the module.)

Third party modules :

  • Adfab_Gdpr
  • Amasty_Base
  • Amasty_CommonRules
  • Amasty_Conditions
  • Amasty_ShippingArea
  • Amasty_Shiprestriction
  • Amasty_Xnotif
  • Anowave_Package
  • Anowave_Sort
  • Apptrian_FacebookPixel
  • Apptrian_ImageOptimizer
  • Apptrian_Minify
  • Bss_CustomProductAttributeExport
  • CompactCode_FixProductBreadcrumbs
  • CustomerParadigm_OrderComments
  • Drc_Soldout
  • Flancer32_Minify
  • Fooman_EmailAttachments
  • Fooman_GoogleAnalyticsPlus
  • Fooman_PrintOrderPdf
  • Fooman_SameOrderInvoiceNumber
  • GalacticLabs_DisableCompareProducts
  • Hackaton_EAVCleaner
  • Ho_Templatehints
  • Iazel_RegenProductUrl
  • Igorludgero_WarmCache
  • Infortis_Base
  • Infortis_Brands
  • Infortis_Cgen
  • Infortis_Dataporter
  • Infortis_Infortis
  • Infortis_Ultimo
  • Infortis_UltraMegamenu
  • Infortis_UltraSlideshow
  • MagePal_CatalogLazyLoad
  • MagePal_CheckoutSuccessMiscScript
  • MagePal_PreviewCheckoutSuccessPage
  • MagePal_Reindex
  • Mageplaza_Core
  • Mageplaza_Gdpr
  • Mageplaza_GoogleAnalytics
  • Mageplaza_GoogleRecaptcha
  • Mageplaza_Seo
  • Mirasvit_Profiler
  • ParadoxLabs_Authnetcim
  • ParadoxLabs_TokenBase
  • Rubic_CleanCheckout
  • Rubic_CleanCheckoutAutocomplete
  • Rubic_CleanCheckoutGeo
  • Rubic_CleanCheckoutNewsletter
  • Rubic_CleanCheckoutSocial
  • Rubic_CleanCheckoutTheme
  • ShipWorks_Module
  • Swissup_Core
  • Swissup_Easyflags
  • Swissup_RefinedUrl
  • Tnegeli_M2CliTools
  • WebdesignStudenten_Adminemails
  • WebdesignStudenten_Backorder
  • WebdesignStudenten_Htmlsitemap
  • Webspeaks_Notification
  • Yireo_CheckoutTester2

Steps to reproduce

  1. Search for a product.
  • Alternatively, after making sure that the store has at least one category, navigate to a category page.

Expected result

  1. The category or search-result page loads normally.

Actual result

  1. full exception trace
Exception #0 (InvalidArgumentException): Invalid scope type 'containers_stores'
#1 Magento\Framework\App\Config\ScopeCodeResolver->resolve() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/RelevanceConfig/App/Config/ScopePool.php:92]
#2 Smile\ElasticsuiteCore\Search\Request\RelevanceConfig\App\Config\ScopePool->getScope() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/RelevanceConfig/App/Config.php:56]
#3 Smile\ElasticsuiteCore\Search\Request\RelevanceConfig\App\Config->getValue() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration/RelevanceConfig/Factory.php:154]
#4 Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration\RelevanceConfig\Factory->getConfigValue() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration/RelevanceConfig/Factory.php:241]
#5 Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration\RelevanceConfig\Factory->getMinimumShouldMatch() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration/RelevanceConfig/Factory.php:131]
#6 Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration\RelevanceConfig\Factory->loadConfiguration() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration/RelevanceConfig/Factory.php:114]
#7 Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration\RelevanceConfig\Factory->create() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration.php:78]
#8 Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:111]
#9 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]
#10 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#11 Magento\Framework\ObjectManager\ObjectManager->create() called at [generated/code/Smile/ElasticsuiteCore/Search/Request/ContainerConfigurationFactory.php:43]
#12 Smile\ElasticsuiteCore\Search\Request\ContainerConfigurationFactory->create() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/Builder.php:214]
#13 Smile\ElasticsuiteCore\Search\Request\Builder->getRequestContainerConfiguration() called at [vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/Builder.php:137]
#14 Smile\ElasticsuiteCore\Search\Request\Builder->create() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php:636]
#15 Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->loadProductCounts() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php:195]
#16 Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->getSize() called at [generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php:24]
#17 Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->getSize() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/Layer/RelevantFilterList.php:69]
#18 Smile\ElasticsuiteCatalog\Model\Layer\RelevantFilterList->getCoverageRates() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/Layer/RelevantFilterList.php:37]
#19 Smile\ElasticsuiteCatalog\Model\Layer\RelevantFilterList->getRelevantFilters() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Block/Navigation.php:186]
#20 Smile\ElasticsuiteCatalog\Block\Navigation->addFacets() called at [vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Block/Navigation.php:174]
#21 Smile\ElasticsuiteCatalog\Block\Navigation->_prepareLayout() called at [vendor/magento/framework/View/Element/AbstractBlock.php:272]
#22 Magento\Framework\View\Element\AbstractBlock->setLayout() called at [vendor/magento/framework/View/Layout/Generator/Block.php:151]
#23 Magento\Framework\View\Layout\Generator\Block->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:80]
#24 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:343]
#25 Magento\Framework\View\Layout->generateElements() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:89]
#26 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#27 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]
#28 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#29 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Page/Config.php:208]
#30 Magento\Framework\View\Page\Config->build() called at [vendor/magento/framework/View/Page/Config.php:544]
#31 Magento\Framework\View\Page\Config->getElementAttribute() called at [vendor/magento/framework/View/Page/Config.php:502]
#32 Magento\Framework\View\Page\Config->addBodyClass() called at [vendor/magento/module-catalog/Controller/Category/View.php:215]
#33 Magento\Catalog\Controller\Category\View->execute() called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:24]
#34 Magento\Catalog\Controller\Category\View\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:107]
#35 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#36 Magento\Catalog\Controller\Category\View\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#37 Magento\Catalog\Controller\Category\View\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#38 Magento\Catalog\Controller\Category\View\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:39]
#39 Magento\Catalog\Controller\Category\View\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:55]
#40 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#41 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#42 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94]
#43 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#44 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:69]
#45 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#46 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [app/code/Infortis/Cgen/Plugin/Magento/Framework/App/FrontController.php:32]
#47 Infortis\Cgen\Plugin\Magento\Framework\App\FrontController->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#48 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#49 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#50 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:136]
#51 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#52 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:257]
#53 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:37]

This error did not happen under Magento 2.2.7 with this version of ElasticSuite, and it does not happen if ElasticSuite is disabled; I tried installing ElasticSuite 2.7.x in case that might help (even though officially it is for Magento 2.3.x only), but it requires a higher version of PHP than my system has, so that would need to wait for later.

I also noticed that another Magento module ended up giving up on its own custom scope type when a similar error was reported.


In case it helps, this is the full changeset between 2.2.7 and 2.2.8, most notably including a new ToolbarMemorizer class; also, I am using this workaround to get the search bar to show up in the Ultimo theme.

@lingwooc
Copy link

I can second this. It also breaks the auto suggest search box.

@mropanen
Copy link

mropanen commented Mar 27, 2019

I'm also getting this on the Categories page in admin.
Edit: this seems to be caused by \Magento\Framework\App\Config\ScopeCodeResolver::resolve, which used to set $resolverScopeCode = $scopeCode, but since this magento/magento2@d79cfa9?diff=split it doesn't anymore.

@romainruaud
Copy link
Collaborator

And ... another BC change on a minor version... great ...

Thank you for reporting it quickly, we gonna release a minor version to handle this change asap.

@mropanen I think you pointed the correct file. We'll have a look.

Thank you guys ! We keep you in touch

@romainruaud
Copy link
Collaborator

It appears that the code is only in 2.2 for now and has not been forward-ported to 2.3 (which is very bad ..).

Anyway, we should fix it on both Elasticsuite 2.6 and 2.7.

@KEVWISNIEW
Copy link

KEVWISNIEW commented Mar 28, 2019

Hi,

here is a workaround with around plugin for temporary fix error `Invalid scope type 'containers_stores'' with Magento 2.2.8 C.E

<?php

namespace [Vendor]\[Module]\Plugin\Framework\App\Config;

use InvalidArgumentException;
use Magento\Framework\App\Config\ScopeCodeResolver as ConfigScopeCodeResolver;
use Magento\Framework\App\ScopeResolverPool;
use Magento\Store\Model\StoreManagerInterface;
use Psr\Log\LoggerInterface;


/**
 * Class ScopeCodeResolver
 * @package [Vendor]\[Module]\Plugin\Framework\App\Config
 */
class ScopeCodeResolver
{

	/**
	 * @var StoreManagerInterface
	 */
	private $storeManager;

	/**
	 * @var ScopeResolverPool
	 */
	private $scopeResolverPool;

	/**
	 * @var []
	 */
	private $resolvedScopeCodes;

	/**
	 * @var LoggerInterface
	 */
	private $logger;

	/**
	 * ScopeCodeResolver constructor.
	 * @param StoreManagerInterface $storeManager
	 * @param LoggerInterface $logger
	 */
	public function __construct(
		ScopeResolverPool $scopeResolverPool,
		StoreManagerInterface $storeManager,
		LoggerInterface $logger
	) {
		$this->scopeResolverPool = $scopeResolverPool;
		$this->storeManager = $storeManager;
		$this->logger = $logger;
	}

	public function aroundResolve(
		ConfigScopeCodeResolver $scopeCodeResolver,
		callable $proceed,
		$scopeType,
		$scopeCode
	) {

		try {
			return $proceed($scopeType, $scopeCode);
		} catch (InvalidArgumentException $e) {
			$this->logger->error($e->getMessage());
		}

		if (!isset($this->resolvedScopeCodes[$scopeType][$scopeCode])) {
			$this->resolvedScopeCodes[$scopeType][$scopeCode] = $scopeCode;
		}

		return $this->resolvedScopeCodes[$scopeType][$scopeCode];
	}
}

@rbayet
Copy link
Collaborator

rbayet commented Mar 28, 2019

Hi @KEVWISNIEW,

I updated your comment to fix the code block rendering, but I didn't reviewed it.
A minor release of ElasticSuite will be published today with our fix (#1362)

Regards,

@rbayet
Copy link
Collaborator

rbayet commented Mar 28, 2019

For future reference :

@rbayet rbayet closed this as completed Mar 28, 2019
@kevwis
Copy link

kevwis commented Mar 28, 2019

the di.xml used for the plugin

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\App\Config\ScopeCodeResolver"> <plugin name="vendor_module_app_config_scope_code_resolver" type="[Vendor]\[Module]\Plugin\Framework\App\Config\ScopeCodeResolver" sortOrder="10" disabled="false" /> </type> </config>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants