magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.46k stars 9.28k forks source link

Search disabled: Cannot instantiate interface `Magento\Framework\Search\EngineResolverInterface` #39011

Open fritzmg opened 1 month ago

fritzmg commented 1 month ago

Preconditions and environment

In our Magento instance we disabled all search related module (Magento_Search, Magento_CatalogSearch, Magento_OpenSearch etc.) as we are using a completely different search implementation (which is rendered on the client side). However, this is not taken into account when updating from e.g. 2.4.5-p8 to 2.4.6-p6 - because then the following error will occur during setup:upgrade:

There is an error in vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php at line: 50
Cannot instantiate interface Magento\Framework\Search\EngineResolverInterface#0 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create()
#1 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get()
#2 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument()
#8 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentrgument()
#9 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArguvedArgument()
#10 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumeeArgumentsInRuntime()
#11 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArgolveArguments()
#12 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create()        
#13 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(206): Magento\Framework\ObjectManager\ObjectManager->get()
#14 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(182): Magento\Framework\ObjectManager\Factory\AbstractFactory->parseArray()  ray()                                                                                                                                                                Argumen
#15 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument()                                                                                                                                                           lvedArg
#16 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument()                                                                                                                                                       eArgume
#17 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime()                                                                                                                                                olveArg
#18 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments()
#19 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create()        
#20 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get()            Argumen
#21 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument()                                                                                                                                                           lvedArg
#22 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument()                                                                                                                                                       eArgume
#23 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime()                                                                                                                                                olveArg
#24 vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments()
#25 vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create()        
#26 setup/src/Magento/Setup/Model/SearchConfigFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create()
#27 setup/src/Magento/Setup/Console/Command/UpgradeCommand.php(142): Magento\Setup\Model\SearchConfigFactory->create()
#28 vendor/symfony/console/Command/Command.php(298): Magento\Setup\Console\Command\UpgradeCommand->execute()
#29 vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#30 vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#31 vendor/magento/framework/Console/Cli.php(116): Symfony\Component\Console\Application->doRun()
#32 vendor/symfony/console/Application.php(171): Magento\Framework\Console\Cli->doRun()
#33 bin/magento(23): Symfony\Component\Console\Application->run()

Since the Magento_Search module is disabled, dependency injection will fail for all services that require an Magento\Framework\Search\EngineResolverInterface parameter in their constructor since there won't be any class that implements that interface.

As a workaround we created a

// app/code/Vendor/Module/Model/DummyEngineResolver.php
namespace Vendor\Module\Model;

use Magento\Framework\Search\EngineResolverInterface;

class DummyEngineResolver implements EngineResolverInterface
{
    public function getCurrentSearchEngine(): string
    {
        return 'dummy';
    }
}
<!-- di.xml -->
<preference for="Magento\Framework\Search\EngineResolverInterface" type="Vendor\Module\Model\DummyEngineResolver"/>

so that setup:upgrade can continue.

Steps to reproduce

  1. Install Magento 2.4.5-p8.
  2. Disable all search modules.
  3. Update to Magento 2.4.6-p6.
  4. Run setup:upgrade.

Expected result

setup:upgrade should finish successfully.

Actual result

setup:upgrade runs into the aforementioned error.

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @fritzmg. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 4 weeks ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Delta commented 2 weeks ago

Hi @fritzmg ,

Thanks for your reporting and collaboration. We have verified the issue and it is reproducible. Hence, Confirming the issue.

Steps to reproduce:-

  1. Install Magento 2.4.5-p8
  2. Disable All search related modules image
  3. Upgrade to 2.4.6-p6
  4. Run setup:upgrade Error displays when user run setup:upgrade image

Thanks.

github-jira-sync-bot commented 2 weeks ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 week ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 1 week ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12842 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 week ago

:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.