magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Click Admin Stores Configuration shows console errors in legacy-build.min.js file

Open kanidaya opened this issue 1 year ago • 10 comments

Preconditions and environment

  • Magento version 2.4.7-p2 Opensource

Steps to reproduce

1.click Store configuration 2.click any of the section from side bar 3.open the any one og section 4.it will not open an check the console

Expected result

Nothing happen. we can able collapse and open any section

Actual result

Can't able to open system configuration sections shows below console errors

Uncaught TypeError: ah.attachEvent is not a function at s (legacy-build.min.js:12:31254) at Function.e [as observe] (legacy-build.min.js:12:31133) at form.js:114:11 at Object.execCb (require.js:1696:33) at Module.check (require.js:883:51) at Module. (require.js:1139:34) at require.js:134:23 at require.js:1189:21 at each (require.js:59:31) at Module.emit (require.js:1188:17)Understand this error theme.js:629 Uncaught TypeError: $(...).filter(...).collapse is not a function at HTMLDivElement. (theme.js:629:12) at Function.each (jquery.js:383:35) at theme.js:626:7 at Object.execCb (require.js:1696:33) at Module.check (require.js:883:51) at Module. (require.js:1139:34) at require.js:134:23 at require.js:1189:21 at each (require.js:59:31) at Module.emit (require.js:1188:17)

Uncaught TypeError: ah.dispatchEvent is not a function
at r (legacy-build.min.js:12:32795)
at D (legacy-build.min.js:12:32626)
at HTMLDocument._methodized [as fire] (legacy-build.min.js:1:6441)
at d (legacy-build.min.js:12:34954)
at legacy-build.min.js:12:34408Understand this error

legacy-build.min.js:12 Uncaught TypeError: $(...).removeClassName is not a function at Object.applyCollapse (legacy-build.min.js:12:147567) at Object.toggleCollapse (legacy-build.min.js:12:148155) at HTMLAnchorElement.eventListener9tmbiETHAp (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:475:41) at element.onclick (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:486:52)Understand this error about:blank:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was receivedUnderstand this error 6c8471f……71a9e0f07aa8885b/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was receivedUnderstand this error 2legacy-build.min.js:12 Uncaught TypeError: $(...).removeClassName is not a function at Object.applyCollapse (legacy-build.min.js:12:147567) at Object.toggleCollapse (legacy-build.min.js:12:148155) at HTMLAnchorElement.eventListenerIIMI4DNdRa (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:529:41) at element.onclick (6c8471f696931ebcf4ba741ab4a76321ac03408b6b79a9af71a9e0f07aa8885b/:540:52)

Screenshot 2024-08-20 085130

Additional information

No response

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] 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”.

kanidaya avatar Aug 20 '24 03:08 kanidaya

Hi @kanidaya. 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 Aug 20 '24 03:08 m2-assistant[bot]

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:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. 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!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Aug 20 '24 03:08 m2-assistant[bot]

Hi @kanidaya ,

Thanks for your reporting and collaboration. We have verified the issue in latest 2.4-develop instance and magento 2.4.7-p2, but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce

  1. Access admin
  2. Navigate to Stores>Settings>Configuration
  3. Observe user is able to access configuration. User is able to access all areas of configuration without interruption.

https://github.com/user-attachments/assets/f4bc2bcd-1eb4-4f7a-96eb-f1d7a44d3a43

Please let us know if any other steps are needed to be performed.

Thanks.

engcom-Delta avatar Aug 20 '24 06:08 engcom-Delta

@engcom-Delta can you share test env url?

kanidaya avatar Aug 20 '24 07:08 kanidaya

@engcom-Delta after click left side menu then click right section collabs its developer mode cause this issue

kanidaya avatar Aug 20 '24 07:08 kanidaya

I have the same issue. It appears randomly on configuration admin page.

nikolaykravchenko avatar Aug 21 '24 09:08 nikolaykravchenko

Hi @kanidaya ,

We have verified in our local, You can verify in 2.4-develop instance by calling @magento give me 2.4-develop instance. Please let us know if any other steps are needed to be performed.

Thanks.

engcom-Delta avatar Aug 28 '24 05:08 engcom-Delta

Hi @engcom-Delta. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Delta, here is your Magento Instance: https://548f3793e0dbb09d97d328fd2792b4f7.instances-prod.magento-community.engineering Admin access: https://548f3793e0dbb09d97d328fd2792b4f7.instances-prod.magento-community.engineering/admin_da81 Login: fd7049c1 Password: 47f5220db7c7

I have the same issue, is there any fix for this?

mohammedTBB avatar Aug 29 '24 13:08 mohammedTBB

Same there

Tanguy-SALMON avatar Sep 03 '24 07:09 Tanguy-SALMON

Same (2.4.7-p2) attachEvent

thespacersm avatar Sep 04 '24 14:09 thespacersm

Same error while trying to collapse customer options at Stores->Configuration->Customer Configuration Magento ver. 2.4.7-p2 image

jointothedarkside avatar Sep 06 '24 16:09 jointothedarkside

We're having the same issue.

barryvdh avatar Sep 16 '24 09:09 barryvdh

Also having the same issue.

likearocket avatar Sep 18 '24 13:09 likearocket

Instead of posting "happens as well", it would really help if people could specify exact steps to reproduce and some details about their environment and if JS files are being minified and/or bundled (using built-in Magento functionality or custom ones). Also if this happens consistently, or only "sometimes"? Which browser is being used?

Maybe we'll see a pattern after a while that might point us in the direction of the bug.

hostep avatar Sep 18 '24 14:09 hostep

If I delete my browser history/cache and refresh the page after it happens, the page will load correctly but then occur again on another admin page.

Merge JavaScript Files: No Enable JavaScript Bundling: Yes Minify JavaScript Files: No

No custom modules doing this.

likearocket avatar Sep 18 '24 14:09 likearocket

Instead of posting "happens as well", it would really help if people could specify exact steps to reproduce and some details about their environment and if JS files are being minified and/or bundled (using built-in Magento functionality or custom ones). Also if this happens consistently, or only "sometimes"? Which browser is being used?

Maybe we'll see a pattern after a while that might point us in the direction of the bug.

@hostep I am working on 2 stores, both are mostly unified (admin side should be the same in both). After upgrading to 2.4.7-p2, one store have this issue (we found it today). The other store do not have it.

Also, after clearing site data in the broken store, the .removeClass errors are gone, but the ah.attachEvent errors are back.

  • the new -p2 patch seems to have this full legacy-build.min.js file newly added

sheepfy avatar Sep 20 '24 11:09 sheepfy

@kanidaya Can you confirm if you are having a patch applied from https://github.com/magento/magento2/issues/33593 (the one made by @AndresInSpace ) ?

sheepfy avatar Sep 20 '24 11:09 sheepfy

@hostep @kanidaya Ok, I have found where this is coming from and I can confirm that is not reproductible on the latest upgrade.

Since I have 2 stores to work with, one store was having no overwrites over the mixins.js file. But my other store it was having various patches on mixins.js file with the scope of solving the https://github.com/magento/magento2/issues/33593 issue, which got solved thanks to @AndresInSpace.

My mixins.js file that was causing the issue it was having this lines:

var contexts = require.s.contexts,
        defContextName = '_',
        defContext = contexts[defContextName],
        unbundledContext = require.s.newContext('$'),
        defaultConfig = defContext.config,
        unbundledConfig = {
            baseUrl: defaultConfig.baseUrl,
            paths: defaultConfig.paths,
            shim: defaultConfig.shim,
            config: defaultConfig.config,
            map: defaultConfig.map
        },
        rjsMixins;

instead of this:

var contexts = require.s.contexts,
        defContextName = '_',
        defContext = contexts[defContextName],
        unbundledContextName = '$',
        unbundledContext = contexts[unbundledContextName] = require.s.newContext(unbundledContextName),
        defaultConfig = defContext.config,
        unbundledConfig = {
            baseUrl: defaultConfig.baseUrl,
            paths: defaultConfig.paths,
            shim: defaultConfig.shim,
            config: defaultConfig.config,
            map: defaultConfig.map
        },
        rjsMixins;

After removing the overwrites, the error is now gone.

Full diff here:

@@ -6,11 +6,11 @@ define('mixins', [
     'module'
 ], function (module) {
     'use strict';
-
     var contexts = require.s.contexts,
         defContextName = '_',
         defContext = contexts[defContextName],
-        unbundledContext = require.s.newContext('$'),
+        unbundledContextName = '$',
+        unbundledContext = contexts[unbundledContextName] = require.s.newContext(unbundledContextName),
         defaultConfig = defContext.config,
         unbundledConfig = {
             baseUrl: defaultConfig.baseUrl,
@@ -205,7 +205,10 @@ require([
     var contexts = require.s.contexts,
         defContextName = '_',
         defContext = contexts[defContextName],
+        unbundledContextName = '$',
+        unbundledContext = contexts[unbundledContextName],
         originalContextRequire = defContext.require,
+        originalContextConfigure = defContext.configure,
         processNames = mixins.processNames;
 
     /**
@@ -219,6 +222,15 @@ require([
         return originalContextRequire(deps, callback, errback);
     };
 
+    /**
+     * Wrap original context configuration to update unbundled context,
+     * that way it is able to respect any changes done after mixins module has initialized.
+     */
+    defContext.configure = function (cfg) {
+        originalContextConfigure(cfg);
+        unbundledContext.configure(cfg);
+    };
+
     /**
      * Copy properties of original 'require' method.
      */
@@ -232,10 +244,19 @@ require([
      * from it every time require call happens.
      */
     defContext.defQueue.shift = function () {
-        var queueItem = Array.prototype.shift.call(this);
+        var queueItem = Array.prototype.shift.call(this),
+            lastDeps = queueItem && queueItem[1];
 
-        queueItem[1] = processNames(queueItem[1], defContext);
+        if (Array.isArray(lastDeps)) {
+            queueItem[1] = processNames(queueItem[1], defContext);
+        }
 
         return queueItem;
     };
+
+    require(['jquery'], function ($) {
+        'use strict';
+
+        $.noConflict();
+    });
 });

sheepfy avatar Sep 20 '24 12:09 sheepfy

I'd like to point out if you have Magento in production mode it's probably from static content versioning change. Do a static content deployment for admin side, then clean or flush cache.

AndresInSpace avatar Sep 20 '24 17:09 AndresInSpace

@kanidaya @likearocket @barryvdh @jointothedarkside

Please ensure if in production mode that you have redeployed admin static content and flushed cache first.

If you still have this issue, please try my patch #39097 and let us know if that resolved it.

I see no requirejs/mixins.js in the stack traces provided, that is why I am thinking it's the mixin based issue - if not a deployment issue due to static-content version change.

AndresInSpace avatar Sep 26 '24 01:09 AndresInSpace

Hi @kanidaya @jointothedarkside ,

Thanks for your reporting and collaboration. We have verified the issue in latest 2.4-develop instance and magento 2.4.7-p2, but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce :

  1. Install 2.4.7 version
  2. Upgrade to 2.4.7-p2 version
  3. Create 2 stores
  4. Navigate to Stores->Configuration->Customer Configuration
  5. Observe error is not displaying in console. image

Please let us know if any other steps are needed to be performed.

Thanks.

engcom-Delta avatar Oct 01 '24 09:10 engcom-Delta

Hi @kanidaya @jointothedarkside ,

We have noticed that this issue has not been updated since long time. Hence we assume that this issue is fixed now, so we are closing it. Please feel to raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks.

engcom-Delta avatar Oct 14 '24 11:10 engcom-Delta

The issue is still exists on 2.4.7-p3. Try to reproduce with these steps:

  1. Open Stores -> Configuration.
  2. Open chrome dev tools (console)
  3. Update page via ctrl+f5 few times (5-10). You will see the error image

nikolaykravchenko avatar Oct 15 '24 05:10 nikolaykravchenko

Hi there.

If there's somebody else facing the same issue, @m2-assistant please take this into consideration because this is a weird situation: the issue seems to be related with PayPal_Braintree, maybe with PayPal_Braintree/js/system.js and I think the reason you can't replicate the bug is that maybe you are testing with nginx instances. For some reason the static content versioning of this module is being handled different by nginx and apache, either in production or dev mode. I had the same issue with a fresh 2.4.7-p3 installation using apache but once I moved to nginx the error fully disappears.

To be sure I disabled PayPal_Braintree on the apache instance and the error disappears too: bin/magento module:disable PayPal_BraintreeGraphQl bin/magento module:disable PayPal_BraintreeGiftWrapping bin/magento module:disable PayPal_BraintreeGiftCardAccount bin/magento module:disable PayPal_BraintreeCustomerBalance bin/magento module:disable PayPal_Braintree

In short terms, if you are running Apache try to disable (in case you are not using it ) PayPal_Braintree. If you are running Nginx maybe you are not aware of this error.

ricardomz avatar Nov 25 '24 22:11 ricardomz

Hi @nikolaykravchenko ,

Thanks for your reporting and collaboration. We have verified the issue in 2.4.7-p3 instance but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce:

  1. Open Stores -> Configuration.
  2. Open chrome dev tools (console)
  3. Update page via ctrl+f5 few times (5-10). You will see the error image

Thanks.

engcom-Delta avatar Nov 26 '24 12:11 engcom-Delta

@ricardomz Thank you, this fixed it!

Hi there.

If there's somebody else facing the same issue, @m2-assistant please take this into consideration because this is a weird situation: the issue seems to be related with PayPal_Braintree, maybe with PayPal_Braintree/js/system.js and I think the reason you can't replicate the bug is that maybe you are testing with nginx instances. For some reason the static content versioning of this module is being handled different by nginx and apache, either in production or dev mode. I had the same issue with a fresh 2.4.7-p3 installation using apache but once I moved to nginx the error fully disappears.

To be sure I disabled PayPal_Braintree on the apache instance and the error disappears too: bin/magento module:disable PayPal_BraintreeGraphQl bin/magento module:disable PayPal_BraintreeGiftWrapping bin/magento module:disable PayPal_BraintreeGiftCardAccount bin/magento module:disable PayPal_BraintreeCustomerBalance bin/magento module:disable PayPal_Braintree

In short terms, if you are running Apache try to disable (in case you are not using it ) PayPal_Braintree. If you are running Nginx maybe you are not aware of this error.

PPekals avatar Nov 27 '24 07:11 PPekals

I am facing same issue in 2.4.7-p3 let me know if anyone found the solution.

patoliyanimita avatar Dec 17 '24 08:12 patoliyanimita

Issue in Adobe Commerce ver. 2.4.7-p3

miteshdhaduk1 avatar Jan 09 '25 11:01 miteshdhaduk1