Introducing ReUI:Open-source UI components and apps built with React, Next.js and Tailwind CSS
Browse ReUI

Trouble with Promise in plugins.bundle.j


Hi,
My company bought Metronic theme few years ago. We developed an internal web application for HR appraisals with Visual Studio 2022, ASP.NET MVC 5.
Last version of Metronic theme we adopt was 8.2.3 and everything worked correctly, both in the development environment and in production.
After some time we decided to make some changes, additions and upgrades to application.
When i tried to run web application in Visual Studio it suddenly reported an error which occurred in file which belongs to theme file "plugins.bundle.js" at line 24990: var promiseRequiresObjectContext = throwsError(function () { return globals.Promise.call(3, noop); }); . Reported error is: "TypeError: Promise constructor cannot be invoked without 'new'".
If I tried to skip javascript debugging application ran but visual appearance was not rendered properly and some buttons and features didn't work.
I upgraded to Metronic version 8.2.8 and then 8.2.9, but error persists. I also tried to run ASP.NET CORE demo which is included in Metronic theme demos but same error is reported.
I use last version of Visual Studio (17.12.4).
Please help to resolve the problem. If we need to buy support extension please let us know.

Kind Regards,
Valentin Faganel


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (12)


Hi,
To speed up solution to problem I have setup computer with Windows 11, Visual Studio and ASP.NET Core application from theme Metronic v. 8.2.9. Installation has been made to clean computer with all latest software updates.
When running application in Visual Studio i get already described error. If I switch of Javascript Debugging application loads succesfully, but clicking on menu to see other pages than landing page is not successful.
Please contact me for access and credentials for this computer on my registered mail.
Kind Regards,
Valentin Faganel



Hi,

Sorry for the late reply.

Have you tried running the application using dotnet cli?

Run command line in your project root folder and execute dotnet run watch command to start the application.

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hi,
Yes, I am using files downloaded from your downloads page. I am transfered to your downloads page from Envato Market, where we bought your theme.
For this reply I am running ASP.NET Core application from Metronic downloads which I just downloaded and prepared for running to test for errors.
Error in plugin.bundle.js occurs during the load of first page at line 24990. Page is not loaded completely, maybe 1/3 at the time when error occurs. If I continue with application executing it stops again with error at line 25019. Almost everything i click on page triggers the two errors already mentioned. Some other errors also occur, at all errors is involved a promise call.
Kind Regards,
Valentin Faganel



Hi,

The problem occurs both in the Metronic Asp.Net-Core version and in my project, errors are reported only in plugin.bundle.js. If I turn off Javascript debugging, the application starts and runs, but the appearance is not quite right, some elements are not in the right place or the right color, shape or font. Also, individual functionalities in the application do not work, such as dropdowns for actions in tables do not open...
I updated or reinstalled dependencies several times with code for versions from 8.2.3 to 8.2.9. I followed instructions from Getting Started docs like https://preview.keenthemes.com/asp.net-core/metronic/docs/getting-started on fresh downloaded package and error still occurs.
Also I tried other sources of help as ChatGPT or Stackoverflow but no success. All I managed to do was to get a different error when using Polyfill.
I update system regularly - browsers, Visual Studio 2022, Windows 11, ...

Kind Regards,
Valentin Faganel



Hi Valentin,

Are you using the Metronic version downloaded from Metronic downloads page?

Does this error appear on the first page load or need to perform some action?

Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hi,

Any progress or idea how to solve this problem?

Kind Regards,
Valentin Faganel



Hi,

We tested the latest Metronic Asp.Net-Core version and could not reproduce this error.
Do you have this problem in the latest version or only in your project?

Make sure to updated and reinstall all dependencies from Starterkit\_keenthemes\tools\package.json

Regards,
Lauris Stepanovs,
Keenthemes Support Team



HI,
The issue occurs when browser takes over after build process is successfully completed.
I update my browsers to last versions regularly - I use Chrome and Edge the most.
I tried with rebuilding the assets as you instructed on freshly downloaded files of version 8.2.9 in folder asp.net-core\Starterkit\_keenthemes\tools\. I did all updates and upgrades of yarn, gulp and other tools as instructed. I got bunch of warning on deprecated or missing resources, that happened as well at previous versions of Metronic theme but error did not occur.
No success - error still occurs when running the application in Visual Studio. Error occurs in all browsers.
Did you try to rebuild assets in for asp.net core version? Does error occurs?
If not is there any option to get those rebuilt assets for download?

Kind Regards,
Valentin Faganel



Hi Valentin Faganel,

Does the issue occur in the browser or during the project build process?

The plugins.bundle.js file is a bundled file for third-party plugins. It's likely that one of the dependencies is outdated. To resolve this, you may need to update the package.json file and rebuild plugins.bundle.js.

You can follow the steps outlined in the documentation below to rebuild the assets:
https://preview.keenthemes.com/html/metronic/docs/getting-started/build/gulp

Thanks



Hi,
Any idea how to solve error
TypeError: Promise executor has already been invoked with non-undefined arguments
as stated in my previous reply?
Kind Regards,
Valentin Faganel



Hi,
I've copied/pasted the suggested code. Now it reports different error
Error says:

TypeError: Promise executor has already been invoked with non-undefined arguments

at line 25019 of plugin.bundle.js, Metronic v. 8.2.9.

executor(3, function () {});

in code block

var BadResolverPromise = function BadResolverPromise(executor) {
var p = new Promise(executor);
executor(3, function () {});
this.then = p.then;
this.constructor = BadResolverPromise;
};


Thanks.

Hi Valentin Faganel

The error seems occurs due to a mismatch between JavaScript ES6+ features and older browser environments. Could you please try this:

1. Add a Promise Polyfill
Include a Promise polyfill before Metronic's scripts load. Add this to your main layout file (e.g., _Layout.cshtml):


<!-- Polyfill for Promise -->
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4.2.8/dist/es6-promise.auto.min.js"></script>

<!-- Load Metronic scripts AFTER the polyfill -->
<script src="~/metronic/plugins/global/plugins.bundle.js"></script>
<script src="~/metronic/js/scripts.bundle.js"></script>


Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(