magento2
magento2 copied to clipboard
Uncaught TypeError: this._each is not a function
Preconditions and environment
- Magento 2.4.7-p2
- New Relic agents installed (not using Magento NewRelic modules)
Steps to reproduce
- Navigate to Dashboard (adminhtml)
- 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”.
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.
- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
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.
Same error on Magento 2.4.6-p6
Same error on Magento 2.4.5-p10
reproduced for me on 2.4.7-p3. It is only reproduced with New Relic installed.
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)
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.
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?
Again, same error on Magento 2.4.6-p7 (last week upgraded from 2.4.6-p6).
@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.
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
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.
Same error on 2.4.4-p11, was not on 2.4.4-p4.
Confirmed on 2.4.7-p2
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
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
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: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced 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: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
ACP2E-3375: [CLOUD] In admin there are many javascript error in console probably fixes this problem.
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
None of last two patches fix this.
@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
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
- Install latest 2.4-develop instance
- New Relic agents installed
- Navigate to Dashboard (adminhtml)
- check console log
Observe no console error is displaying
Can you please re-verify and confirm if you are still facing the issue. Thanks.
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
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
- Install latest 2.4-develop instance
- New Relic agents installed
- Navigate to Dashboard (adminhtml)
- Navigate to content > pages > pagebuilder.
- check console log
- Lots of errors logged repeatedly
Thanks.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13343 is successfully created for this GitHub issue.
: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.
:x: You don't have permission to export this issue.
Hi @pjw345 Is there any fix to this bug?
@bohdanbatsenko as previously stated, replacing the legacy-build.min.js with the version of 2.4.7-p1 appeared to resolve the issue
Replacing legacy-build.min.js with the version found in 2.4.7-p1 resolved the error for me. Waiting on an official fix.
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...