magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento Analytics must be decoupled

Open IbrahimS2 opened this issue 1 year ago • 7 comments

Preconditions and environment

  • Magento version: 2.4.7
  • Anything else that would help a developer reproduce the bug: Add the following in your composer json file:
    "replace": {
        "magento/module-analytics": "*",
        "magento/module-admin-analytics": "*",
        "magento/module-cms-page-builder-analytics": "*",
        "magento/module-customer-analytics": "*",
        "magento/module-catalog-analytics": "*",
        "magento/module-quote-analytics": "*",
        "magento/module-review-analytics": "*",
        "magento/module-sales-analytics": "*",
        "magento/module-wishlist-analytics": "*",
        "magento/module-page-builder-analytics": "*",
        "magento/module-page-builder-admin-analytics": "*"
}

Steps to reproduce

This error when running indexer using cli and after digging in it is used by the following module:

vendor/magento/module-query-xml/Model/Config/Config.php: * Config of ReportXml
vendor/magento/module-query-xml/Model/Config/ConfigInterface.php: * Interface for ReportXml Config
vendor/magento/module-query-xml/Model/Config/ConfigInterface.php:     * Config of ReportXml
vendor/magento/module-query-xml/etc/di.xml:            <argument name="converter" xsi:type="object">Magento\Analytics\ReportXml\Config\Converter\Xml</argument>
vendor/magento/module-data-exporter/etc/di.xml:            <argument name="converter" xsi:type="object">Magento\Analytics\ReportXml\Config\Converter\Xml</argument>
vendor/magento/module-data-exporter/Config/Config.php: * Config of ReportXml

Expected result

The shop must operate normally

Actual result

Class "Magento\Analytics\ReportXml\Config\Converter\Xml" does not exist

Additional information

No response

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [X] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

IbrahimS2 avatar Jun 30 '24 22:06 IbrahimS2

Hi @IbrahimS2. 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:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Jun 30 '24 22:06 m2-assistant[bot]

Hi @engcom-Dash. 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:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jul 01 '24 12:07 m2-assistant[bot]

Hi @IbrahimS2

Thanks for reporting and collaboration.

Verified the issue on Magento 2.4.7 and the issue is reproducible.

Steps to reproduce:

  1. Install 2.4.7 instance
  2. Add the following code in composer.json file
"replace": {
        "magento/module-analytics": "*",
        "magento/module-admin-analytics": "*",
        "magento/module-cms-page-builder-analytics": "*",
        "magento/module-customer-analytics": "*",
        "magento/module-catalog-analytics": "*",
        "magento/module-quote-analytics": "*",
        "magento/module-review-analytics": "*",
        "magento/module-sales-analytics": "*",
        "magento/module-wishlist-analytics": "*",
        "magento/module-page-builder-analytics": "*",
        "magento/module-page-builder-admin-analytics": "*"
}
  1. Perform bin/magento in:rein
  2. Verify if the Magento instance is working or not

We are getting the below error after performing reindexing

Class "Magento\Analytics\ReportXml\Config\Converter\Xml" does not exist

Hence, Confirming the issue.

Please take a look at the screenshots I've attached

Added the above code in composer.json

38890_2

Error message after performing bin/magento in:rein :

38890_1

engcom-Dash avatar Jul 03 '24 07:07 engcom-Dash

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

github-jira-sync-bot avatar Jul 03 '24 07:07 github-jira-sync-bot

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

m2-assistant[bot] avatar Jul 03 '24 07:07 m2-assistant[bot]

I fixed Magento has Interface Implementing "Magento\Framework\Config\ConverterInterface" I and I removed "Magento\Analytics\ReportXml\Config\Converter\Xml"

I needed to change the code a bit, added an attribute there. I made it in the form of patches

{
    "extra": {
        "patches": {
            "magento/module-query-xml": {
                "Class \"Magento\\Analytics\\ReportXml\\Config\\Converter\\Xml\" does not exist": "patches/composer/magentoupgrade_bug1.patch"
            },
            "magento/module-data-exporter": {
                "Class \"Magento\\Analytics\\ReportXml\\Config\\Converter\\Xml\" does not exist": "patches/composer/magentoupgrade_bug2.patch"
            }
        }
    }
}

magento/module-query-xml

diff --git a/etc/di.xml b/etc/di.xml
--- a/etc/di.xml
+++ b/etc/di.xml	(date 1724593892171)
@@ -21,11 +21,6 @@
             <argument name="data" xsi:type="object">Magento\QueryXml\Model\Config\Data</argument>
         </arguments>
     </type>
-    <type name="Magento\QueryXml\Model\Config\Converter">
-        <arguments>
-            <argument name="converter" xsi:type="object">Magento\Analytics\ReportXml\Config\Converter\Xml</argument>
-        </arguments>
-    </type>
     <virtualType name="Magento\QueryXml\Model\Config\Data" type="Magento\Framework\Config\Data">
         <arguments>
             <argument name="reader" xsi:type="object">Magento\QueryXml\Model\Config\Reader</argument>

magento/module-data-exporter

diff --git a/etc/di.xml b/etc/di.xml
--- a/etc/di.xml
+++ b/etc/di.xml	(date 1724593938546)
@@ -37,11 +37,6 @@
             <argument name="cacheId" xsi:type="string">Magento_Et_Config_CacheId</argument>
         </arguments>
     </virtualType>
-    <type name="Magento\DataExporter\Config\Converter">
-        <arguments>
-            <argument name="converter" xsi:type="object">Magento\Analytics\ReportXml\Config\Converter\Xml</argument>
-        </arguments>
-    </type>
     <type name="Magento\DataExporter\Config\Config">
         <arguments>
             <argument name="data" xsi:type="object">Magento\DataExporter\Config\Data</argument>

diff --git a/Config/Converter.php b/Config/Converter.php
--- a/Config/Converter.php
+++ b/Config/Converter.php	(date 1724595562058)
@@ -56,33 +56,33 @@

         $records = [];
         foreach ($configData['config'][0]['record'] as $queryData) {
-            $records[$queryData['name']] = [
-                'name' => $queryData['name'],
-                'skipNull' => isset($queryData['skipNull']) && $queryData['skipNull'] == "true"
+            $records[$queryData['@attributes']['name']] = [
+                'name' => $queryData['@attributes']['name'],
+                'skipNull' => isset($queryData['@attributes']['skipNull']) && $queryData['@attributes']['skipNull'] == "true"
             ];
             $idField = null;
             foreach ($queryData['field'] as $fieldData) {
                 $field = [
-                    'name' => $fieldData['name'],
-                    'type' => $fieldData['type'],
-                    'provider' => isset($fieldData['provider']) ? $fieldData['provider'] : null,
-                    'repeated' => (isset($fieldData['repeated']) && $fieldData['repeated'] == "true") ? true : false
+                    'name' => $fieldData['@attributes']['name'],
+                    'type' => $fieldData['@attributes']['type'],
+                    'provider' => isset($fieldData['@attributes']['provider']) ? $fieldData['@attributes']['provider'] : null,
+                    'repeated' => (isset($fieldData['@attributes']['repeated']) && $fieldData['@attributes']['repeated'] == "true") ? true : false
                 ];
-                if ($fieldData['type'] == 'ID') {
-                    $idField = $fieldData['name'];
+                if ($fieldData['@attributes']['type'] == 'ID') {
+                    $idField = $fieldData['@attributes']['name'];
                 }
-                if (isset($fieldData['provider'])) {
-                    if (isset($fieldData['using'])) {
-                        foreach ($fieldData['using'] as $usingField) {
+                if (isset($fieldData['@attributes']['provider'])) {
+                    if (isset($fieldData['@attributes']['using'])) {
+                        foreach ($fieldData['@attributes']['using'] as $usingField) {
                             $field['using'][$usingField['field']] = $usingField;
                         }
                     } else {
                         $field['using'][$idField] = ['field' => $idField];
                     }
                 }
-                $records[$queryData['name']]['field'][$field['name']] = $field;
+                $records[$queryData['@attributes']['name']]['field'][$field['name']] = $field;
             }
-            $records[$queryData['name']]['ID'] = $idField;
+            $records[$queryData['@attributes']['name']]['ID'] = $idField;
         }
         return $records;
     }

nik4152 avatar Aug 25 '24 15:08 nik4152

Hello,

I have also encountered this issue, and in my case, I preferred to reinstall magento/module-analytics by removing it from the "replace" section in my composer.json file.

I hope this helps. Have a great day,

ljr95 avatar Oct 16 '24 12:10 ljr95