Skip to content

Loading https://js.mollie.com/v1/mollie.min.js doesn't work and stops checkout #291

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

Closed
hostep opened this issue Aug 19, 2020 · 3 comments
Closed

Comments

@hostep
Copy link

hostep commented Aug 19, 2020

Describe the bug

Hi guys

When you enable "Use Mollie Components" for creditcards and have minifying of javascript enabled in Magento, then on the checkout, the mollie plugin will try to load https://js.mollie.com/v1/mollie.min.js instead of https://js.mollie.com/v1/mollie.js
This will crash the checkout and prevent you from checking out.

Magento will add .min to all javascripts it tries to load when minifying js is enabled, even for external requests.
They have a mechanism to disable this where you can specify a regular expressions of strings which match with for example js.mollie.com to prevent this from happening.

Since your module supports Magento 2.2.x, 2.3.x and 2.4.x there is no simple way to do this because the "easy" mechanism to do this in xml has changed significantly between 2.2.x and 2.3.x, since it was more or less broken in 2.2.x (magento/magento2#13687 changed that)

I strongly suggest you use an after plugin to prevent that automatic .min addition in the external request to be appended, that will work in both 2.2.x and 2.3.x (I assume it should work in 2.4.x as well, but haven't tested that), see here how to do this: https://magento.stackexchange.com/a/198480/2911

This can be quite an important bug to fix, a lot of shops have minifying of javascript enabled.

Thanks!

Used versions

  • Magento Version number(eg 2.3.5): seen on 2.2.3
  • Open source/Enterprise/B2b: Open source
  • Mollie version number (Check configuration): seen on 1.14.0, 1.16.0 and 1.16.1

To Reproduce
Steps to reproduce the behavior:

  1. Enable minifying javascript in Magento (bin/magento config:set dev/js/minify_files 1)
  2. Put Magento in production mode and recompile static assets if needed
  3. Enable "Use Mollie Components" in the creditcards section
  4. Create an account or login to an existing account
  5. Put some product in your cart
  6. Go the the second step of the checkout

Expected behavior
Seeing request to non-existing https://js.mollie.com/v1/mollie.min.js file in your inspector which breaks the checkout

Actual behavior
Seeing request to https://js.mollie.com/v1/mollie.js and checkout keeps working

Screenshots
Screenshot 2020-08-19 at 14 59 51

Additional context

@Frank-Magmodules
Copy link
Collaborator

Hi @hostep,

We are happy to share that we've just released the new 1.17.0 version with a fix for this issue. Thank you again for the detailed reports and patience. We are closing this issue now but please feel free to reopen the issue if this still occurs.

@hostep
Copy link
Author

hostep commented Sep 21, 2020

@Frank-Magmodules & @michielgerritsen: this was implemented incorrectly. It doesn't work in production mode at least because the plugin was defined in etc/frontend/di.xml instead of etc/di.xml. In production mode, the static content deployment is executed via bin/magento setup:static-content:deploy ... which doesn't run in the frontend context from what I can tell (tested on Magento OS 2.2.3).

Can you verify this and correct please?

Thanks!

@michielgerritsen
Copy link
Collaborator

Hi @hostep,

Thanks for pointing this out, it looks like you are right. This will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants