magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Uncaught TypeError: this._each is not a function

Open pjw345 opened this issue 1 year ago • 11 comments

Preconditions and environment

  • Magento 2.4.7-p2
  • New Relic agents installed (not using Magento NewRelic modules)

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

  • [ ] 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.
  • [ ] 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”.

pjw345 avatar Oct 08 '24 14:10 pjw345

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.


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 Oct 08 '24 14:10 m2-assistant[bot]

Same error on Magento 2.4.6-p6

pisicabogdan avatar Oct 09 '24 15:10 pisicabogdan

Same error on Magento 2.4.5-p10

mrafyq avatar Oct 15 '24 15:10 mrafyq

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

usuyukiso avatar Oct 15 '24 15:10 usuyukiso

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)

MagePsycho avatar Oct 16 '24 18:10 MagePsycho

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.

bbrigagao avatar Oct 16 '24 18:10 bbrigagao

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?

pjw345 avatar Oct 17 '24 06:10 pjw345

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

pisicabogdan avatar Oct 17 '24 07:10 pisicabogdan

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

bbrigagao avatar Oct 17 '24 10:10 bbrigagao

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 :

  • Catalog / Add product, Edit Product
  • Catalog / Categories
  • Sales / Orders, Invoices, ..
  • Content / Edit Page CMS, Block CMS
  • Stores / Configuration

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

scadox avatar Oct 17 '24 13:10 scadox

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.

MagePsycho avatar Oct 17 '24 18:10 MagePsycho

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

stefancic avatar Oct 22 '24 17:10 stefancic

Confirmed on 2.4.7-p2

alexgalco avatar Oct 23 '24 19:10 alexgalco

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

pisicabogdan avatar Oct 29 '24 10:10 pisicabogdan

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

pjw345 avatar Oct 29 '24 10:10 pjw345

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- 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 Oct 30 '24 06:10 m2-assistant[bot]

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

jonaschen623 avatar Oct 31 '24 22:10 jonaschen623

None of last two patches fix this.

stefancic avatar Nov 01 '24 05:11 stefancic

@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

lamasfoker avatar Nov 06 '24 10:11 lamasfoker

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.

engcom-Delta avatar Nov 06 '24 11:11 engcom-Delta

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

bohdanbatsenko avatar Nov 07 '24 08:11 bohdanbatsenko

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.

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

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

github-jira-sync-bot avatar Nov 12 '24 06:11 github-jira-sync-bot

: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.

m2-assistant[bot] avatar Nov 12 '24 06:11 m2-assistant[bot]

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

github-jira-sync-bot avatar Nov 12 '24 07:11 github-jira-sync-bot

Hi @pjw345 Is there any fix to this bug?

bohdanbatsenko avatar Nov 12 '24 07:11 bohdanbatsenko

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

pjw345 avatar Nov 12 '24 08:11 pjw345

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

jtolhurst-trellis avatar Nov 12 '24 18:11 jtolhurst-trellis

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

Another extra change made it in the codebase today: ACP2E-3459: Request for additional changes to fully complete the ACP2E-3375 fix

No idea if this will do anything in scope of this ticket...

hostep avatar Nov 18 '24 15:11 hostep