Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magento 2.4.4 admin panel - Uncaught SyntaxError: Unexpected token 'const' #35325

Closed
5 tasks
sanchit-redmonks opened this issue Apr 19, 2022 · 15 comments · Fixed by #35540
Closed
5 tasks

Magento 2.4.4 admin panel - Uncaught SyntaxError: Unexpected token 'const' #35325

sanchit-redmonks opened this issue Apr 19, 2022 · 15 comments · Fixed by #35540
Assignees
Labels
Area: Admin UI Component: Admin Component: Theme Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@sanchit-redmonks
Copy link

sanchit-redmonks commented Apr 19, 2022

Summary (*)

Magento 2.4.4 running on PHP 8.1 in Production mode

If you enable the js bundling and minify the scripts.
php bin/magento config:set dev/js/minify_files 1
php bin/magento config:set dev/js/enable_js_bundling 1

After running the deployment and logging into the admin panel. We can't click on any menue option. There is an error in the browser console: Uncaught SyntaxError: Unexpected token 'const'

Preconditions (*)

  1. PHP 8.1
  2. Magento 2.4.4, 2.4-develop
  3. Magento instace should be in production mode

Steps to reproduce (*)

  1. Enable JS bundling.
  2. Minify the JS files
  3. Run deployment
  4. Login to the admin panel.

Expected result (*)

We should be able to access admin panel without any error.

Actual result (*)

We are getting the following error and not able to click on any menu option:

Admin Error


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Apr 19, 2022

Hi @sanchit-redmonks. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

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

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Apr 19, 2022

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

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components 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.

@engcom-November engcom-November added the Reported on 2.4.4 Indicates original Magento version for the Issue report. label Apr 19, 2022
@engcom-November
Copy link

engcom-November commented Apr 19, 2022

Verified the issue on Magento 2.4.4 version and 2.4-develop branch as well and the issue is reproducible on both the versions
Configured JS Bundling as per devdocs
Login to admin - Unable to navigate to any other pages. None of the Menu options are working.
image

@engcom-November engcom-November added Component: Theme Component: Admin Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Admin UI Area: UI Framework Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Area: UI Framework labels Apr 19, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Apr 19, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-2880 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Apr 19, 2022

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

@softinfoline
Copy link

softinfoline commented Apr 19, 2022

Here is the solution:-
lib/web/jquery/bootstrap/collapse.js
@@ -32,7 +32,7 @@ define([
const VERSION = '5.1.3'
const NAME = 'collapse'
const DATA_KEY = 'bs.collapse'
const EVENT_KEY = .${DATA_KEY}
const EVENT_KEY = .${DATA_KEY};
const DATA_API_KEY = '.data-api'

const Default = {

@@ -45,17 +45,17 @@ define([
parent: '(null|element)'
}

const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const EVENT_HIDE = `hide${EVENT_KEY}`
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
const EVENT_SHOW = `show${EVENT_KEY}`;
const EVENT_SHOWN = `shown${EVENT_KEY}`;
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;

const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_COLLAPSE = 'collapse'
const CLASS_NAME_COLLAPSING = 'collapsing'
const CLASS_NAME_COLLAPSED = 'collapsed'
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`
const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'

const WIDTH = 'width'

@@ -204,10 +204,10 @@ define([
}

    const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)
    const scrollSize = `scroll${capitalizedDimension}`
    const scrollSize = `scroll${capitalizedDimension}`;

    this._queueCallback(complete, this._element, true)
    this._element.style[dimension] = `${this._element[scrollSize]}px`
    this._element.style[dimension] = `${this._element[scrollSize]}px`;
}

Collapse.prototype.hide = function() {

@@ -222,7 +222,7 @@ define([

    const dimension = this._getDimension()

    this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`
    this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;

    reflow(this._element)

and

lib/web/jquery/bootstrap/tab.js

@@ -28,14 +28,14 @@ define([
const VERSION = '5.1.3'
const NAME = 'tab'
const DATA_KEY = 'bs.tab'
const EVENT_KEY = .${DATA_KEY}
const EVENT_KEY = .${DATA_KEY};
const DATA_API_KEY = '.data-api'

const EVENT_HIDE = `hide${EVENT_KEY}`
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
const EVENT_SHOW = `show${EVENT_KEY}`
const EVENT_SHOWN = `shown${EVENT_KEY}`
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_SHOW = `show${EVENT_KEY}`;
const EVENT_SHOWN = `shown${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;

const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'
const CLASS_NAME_ACTIVE = 'active'

Direct link:
https://github.com/softinfoline/magento2/blob/be6341ebd31e0b67f6339714ac570689b88c8016/lib/web/jquery/bootstrap/collapse.js
https://github.com/softinfoline/magento2/blob/d864fc370673453bf82f4e5f546f732224fe6880/lib/web/jquery/bootstrap/tab.js

@lagunacellar
Copy link

Yes, this solution works! Thanks!

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Apr 26, 2022
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in High Priority Backlog Apr 26, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog Apr 28, 2022
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Dev In Progress in High Priority Backlog May 13, 2022
@m2-community-project m2-community-project bot moved this from Dev In Progress to Pull Request In Progress in High Priority Backlog May 16, 2022
@kolaente
Copy link
Contributor

Is someone working on a PR to fix this?

@ssx
Copy link
Contributor

ssx commented May 24, 2022

Magento have provided me with the following patch for this: https://gist.github.com/ssx/275bc6c9674277ed8d26592235f1cc6b

@fredden
Copy link
Member

fredden commented Jun 5, 2022

@sidolov please can you confirm why this issue has been closed.

Is this fixed in faa7e0e (which introduced a806598 and 26b4840)? I can't see a corresponding pull request for this change.

What should we do about #35540 (which fixes all cases not just those covered in 26b4840 and a806598) ?

@technodelight
Copy link

This is still present in 2.4.4-p2

@Seppo-Konttinen-Solteq
Copy link

Hi. Also facing this issue in 2.4.4-p2

@scottbolasevich
Copy link

same

@boneio
Copy link

boneio commented Jun 19, 2023

Issue still present on 2.4.4-p3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Admin UI Component: Admin Component: Theme Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Development

Successfully merging a pull request may close this issue.