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.56k stars 9.32k forks source link

Uncaught TypeError: this._each is not a function #39247

Open pjw345 opened 1 month ago

pjw345 commented 1 month ago

Preconditions and environment

Steps to reproduce

  1. Navigate to Dashboard (adminhtml)
  2. check console log

Expected result

Expect no console errors logged

Actual result

Lots of errors logged repeatedly: legacy-build.min.js:1 Uncaught TypeError: this._each is not a function at e (legacy-build.min.js:1:14513) at nr-spa-1.267.0.min.js:2:81604 at Array.forEach () at y.ce [as onFinished] (nr-spa-1.267.0.min.js:2:81583) at y.finish (nr-spa-1.267.0.min.js:2:76545) at nr-spa-1.267.0.min.js:2:76118

Additional information

This is related to legacy-build.min.js which is released with Magento 2.4.7-p2. If the file is replaced by the version released by Magento 2.4.7-p1 the error goes away.

See also issue logged on New Relic github: https://github.com/newrelic/newrelic-browser-agent/issues/1201

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @pjw345. 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.

pisicabogdan commented 1 month ago

Same error on Magento 2.4.6-p6

mrafyq commented 1 month ago

Same error on Magento 2.4.5-p10

usuyukiso commented 1 month ago

reproduced for me on 2.4.7-p3. It is only reproduced with New Relic installed.

MagePsycho commented 1 month ago

Same issue on Magento 2.4.5-p2. It is only reproduced with New Relic installed. Got it fixed by using the legacy-build js file from Magento 2.4.7-p1 (still yet to check it's consequences)

bbrigagao commented 1 month ago

I saw this error after updating projects to the bulletin APSB24-61 on projects with New Relic configured.

If you guys check the release notes there was a fix on prototype js scripts (I don't know if could be related to this).

There are 3 types of New Relic accounts and the script will be injected according to your account:

Lite - https://js-agent.newrelic.com/nr-rum-1.267.0.min.js Pro - https://js-agent.newrelic.com/nr-full-1.267.0.min.js SPA (pro + spa) - https://js-agent.newrelic.com/nr-spa-1.267.0.min.js

I saw this error only happens on projects that have SPA accounts, perhaps it could be an incompatibility with this SPA script.

pjw345 commented 4 weeks ago

I've checked the bulletin and have not seen anything regarding legacy-build.min.js.

https://helpx.adobe.com/security/products/magento/apsb24-61.html

@bbrigagao can you remember where you read that or did I miss it?

pisicabogdan commented 4 weeks ago

Again, same error on Magento 2.4.6-p7 (last week upgraded from 2.4.6-p6).

bbrigagao commented 4 weeks ago

@pjw345 I found that the legacy-build.min.js is related to prototype js on this issue. So, I suspected that could be related to this since on bulletin APSB24-61 there was a fix on prototype js scripts.

scadox commented 4 weeks ago

Hi Adobe Commerce Support, same problem with Magento (2.4.7-p3) and not have problem with preview (2.4.7-p2) hosted in Magento Cloud.

Where i have this problem in Admin Panel :

Uncaught TypeError: this._each is not a function at e (legacy-build.min.js:1:14513) at nr-spa-1.268.0.min.js:2:83492 at Array.forEach (<anonymous>) at y.ce [as onFinished] (nr-spa-1.268.0.min.js:2:83471) at b.finish (nr-spa-1.268.0.min.js:2:78433) at nr-spa-1.268.0.min.js:2:78006

File from vendor lib (legacy-build.min.js) = [...] var Enumerable = (function() { function e(E, D) { try { this._each(E, D) [...]

Cordialement, Matthew Lafrance

MagePsycho commented 4 weeks ago

I believe the issue can be resolved by fixing the legacy-build.min.js file directly. According to this ticket - https://github.com/newrelic/newrelic-browser-agent/issues/1201, it appears that the legacy JavaScript is overriding Object.values(), which is causing the problem.

Please let us know if the Magento team or any of you have identified a permanent fix.

stefancic commented 3 weeks ago

Same error on 2.4.4-p11, was not on 2.4.4-p4.

alexgalco commented 3 weeks ago

Confirmed on 2.4.7-p2

pisicabogdan commented 2 weeks ago

Changed legacy-build.min.js with the version from 2.4.6-p5 but with no effect; the problem isn't from legacy-build.min.js

pjw345 commented 2 weeks ago

Changed legacy-build.min.js with the version from 2.4.6-p5 but with no effect; the problem isn't from legacy-build.min.js

We are running 2.4.7-p2 and replaced the legacy-build.min.js with the version of 2.4.7-p1

m2-assistant[bot] commented 2 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:

hostep commented 2 weeks ago

ACP2E-3375: [CLOUD] In admin there are many javascript error in console probably fixes this problem.

jonaschen623 commented 2 weeks ago

adobe has an official patch for this issue, please raise a support ticket. Below one is for magento 2.4.6 ACSD-62427_2.4.6-p7.patch

stefancic commented 2 weeks ago

None of last two patches fix this.

lamasfoker commented 1 week ago

@stefancic the patch provided by @hostep and @jonaschen623 it's working. You need to apply this change to legacy-build.min.js:

  n(Object, {
    extend: n,
    inspect: r,
    toJSON: g ? Q : H,
    toQueryString: J,
    toHTML: v,
    keys: Object.keys || E,
-    values: N,
+    values: Object.values || N,
    clone: z,
    isElement: L,
    isArray: B,
    isHash: y,
    isFunction: t,
    isString: l,
    isNumber: M,
    isDate: A,
    isUndefined: u
  });

You can apply the following patch with Quality Patches Tool. It is tested on Adobe Commerce Cloud 2.4.6-p7. issues-39247.patch

engcom-Delta commented 1 week ago

Hi @pjw345 ,

Thanks for your reporting and collaboration. We have verified the issue in Latest 2.4-develop instance & 2.4.8-beta1 instance, but we are unable to reproduce the issue. Kindly refer the screenshots.

Steps to reproduce

  1. Install latest 2.4-develop instance
  2. New Relic agents installed
  3. Navigate to Dashboard (adminhtml)
  4. check console log Observe no console error is displaying image

Can you please re-verify and confirm if you are still facing the issue. Thanks.

bohdanbatsenko commented 1 week ago

Hi @pjw345 , I have the same issue. It exists in admin panel -> Content -> Pages -> Page builder. Try to open page builder and check console. On my staging magento website, upgraded to magento 2.47, the issue exists only in page builder editing mode. Thanks

engcom-Delta commented 3 days ago

Hi @pjw345 @bohdanbatsenko ,

Thanks for your reporting and collaboration. We have verified the issue in Latest 2.4-develop instance and the issue is reproducible. Kindly refer the screenshots.

Steps to reproduce

  1. Install latest 2.4-develop instance
  2. New Relic agents installed
  3. Navigate to Dashboard (adminhtml)
  4. Navigate to content > pages > pagebuilder.
  5. check console log
  6. Lots of errors logged repeatedly image

Thanks.

github-jira-sync-bot commented 3 days ago

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

m2-assistant[bot] commented 3 days 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.

github-jira-sync-bot commented 3 days ago

:x: You don't have permission to export this issue.

bohdanbatsenko commented 3 days ago

Hi @pjw345 Is there any fix to this bug?

pjw345 commented 3 days ago

@bohdanbatsenko as previously stated, replacing the legacy-build.min.js with the version of 2.4.7-p1 appeared to resolve the issue

jtolhurst-trellis commented 3 days ago

Replacing legacy-build.min.js with the version found in 2.4.7-p1 resolved the error for me. Waiting on an official fix.