Skip to content

[2.4-develop] Cannot instantiate Magento\Framework\MessageQueue\ConfigInterface if optional module Magento_MessageQueue is disabled #26080

Closed
@korostii

Description

@korostii

Summary (*)

Steps:

  1. Try to install 2.4-develop
  2. When prompted by the web setup, uncheck the optional Magento_MessageQueue module so that it would be disabled
    Expected result: Magento installed okay.
    Actual result (web setup): dies silently, progress stopped at Magento_Amqp installation
    Actual result (via php bin/magento setup:install): Error during installation
[Progress: 164 / 636]
Module 'Magento_Amqp':
PHP Fatal error:  Uncaught Error: Cannot instantiate interface Magento\Framework\MessageQueue\ConfigInterface in /var/www/magento2/magento2/lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php:121

Examples (*)

Concrete class for the aforementioned Magento\Framework\MessageQueue\ConfigInterface is declared in app/code/Magento/MessageQueue/etc/di.xml:

<preference for="Magento\Framework\MessageQueue\ConfigInterface" type="Magento\Framework\MessageQueue\Config\Proxy" />

Which is fine by itself, except two classes in the Magento_Amqp module rely on this interface, yet Magento_Amqp does not declare any dependencies on Magento_MessageQueue module.

Proposed solution

a) quick workaround for anyone seeing this on their local machine: please either disable Magento_Amqp module or enable Magento_MessageQueue module and try again.
b) declare this dependency from inside Magento_Amqp module via module.xml, composer.json so that the setup would detect and detect this issue at the module selection step
c) move the di.xml entry to the global app/etc/di.xml since involves two framework classes anyway
d) long-term goal: since Magento\Framework\MessageQueue\ConfigInterface is marked as deprecated, its usages in Magento_Amqp should be removed from the classes completely. This will probably be a breaking change (removal of argument from constructor), but I assume it is not a problem for 2.4-develop branch?

Please let me know which solution is preferred (I might have some spare time to go forward with it and provide a Pull Request a bit later)

Metadata

Metadata

Assignees

Labels

Component: MessageQueueFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions