magento2-replace-core icon indicating copy to clipboard operation
magento2-replace-core copied to clipboard

2.4.4, seems Magento\GraphQl\Model\Query\Logger\NewRelic depends on removed module-new-relic-reporting

Open ProxiBlue opened this issue 3 years ago • 2 comments

Hello,

> ./bin/magento setup:di:compile
Compilation was started.
Area configuration aggregation... 5/9 [===============>------------]  55% 16 secs 326.0 MiB
In ClassReader.php line 57:
                                                                                                                                                                              
  Impossible to process constructor argument Parameter #0 [ <required> Magento\NewRelicReporting\Model\Config $config ] of Magento\GraphQl\Model\Query\Logger\NewRelic class  
                                                                                                                                                                              

In GetParameterClassTrait.php line 34:
                                                                 
  Class "Magento\NewRelicReporting\Model\Config" does not exist  
                                                                 

setup:di:compile

Script ./bin/magento setup:di:compile handling the build-full event returned with error code 1

seems Magento\GraphQl\ has a hard dependency on the nwrelic module to exist.

ProxiBlue avatar Sep 14 '22 11:09 ProxiBlue

ref: https://github.com/magento/magento2/issues/35479

ProxiBlue avatar Sep 14 '22 11:09 ProxiBlue

Thanks for reporting this. Indeed, I can see in the di.xml of the GraphQl module that there is a hard dependency here:

    <type name="Magento\GraphQl\Model\Query\Logger\LoggerPool">
        <arguments>
            <argument name="loggers" xsi:type="array">
                <item name="newRelic" xsi:type="object">Magento\GraphQl\Model\Query\Logger\NewRelic</item>
            </argument>
        </arguments>
    </type>

As of yet, I don't know if I can come up with a fix for this. The dependencies in the GraphQl module its module.xml file seem to be missing out (even though the composer.json file mentions the magento/module-new-relic-reporting dependency correctly). To me, it seems bad design to have added this DI type in the GraphQL module, while it should have been the responsibility of the NewRelic reporting module instead.

Anyway, these issues simply arise when using composer replacements. None of the replacement packages is perfect: There are numerous conflicts when using combinations of these packages. For instance, using both yireo/magento2-replace-core and yireo/magento2-replace-graphql works perfectly, but removing only one, might bump into issues.

I might be a bit grumpy here, but I believe removing the magento/module-new-relic-reporting replacement yet again would perhaps fix things, but it would not live up to the goal of this package: To document whatever could be replaced, bugs aside.

Ideally, there would be a tool that allows you to calculate which replacements are possible and which are not. But such a tool is not there yet.

jissereitsma avatar Sep 15 '22 06:09 jissereitsma

I'm closing this due to inactivity.

jissereitsma avatar Feb 01 '24 08:02 jissereitsma