amazon-payments-magento-2-plugin: Mobile payments is not possible when Magento in production mode

What I expected

It should be possible to use Amazon Pay on production mode.

JS compilation is enabled by default in Magento 2 production mode. Mobile device has touch screen so redirect is used.

What happened instead

After customer successfully logged in he redirected back to the store processAuthHash action. “You will be redirected shortly” message appears behind a spinner (processStart). But redirect never starts.

Steps to reproduce the issue

On server

Enable Production mode

On mobile device
  1. Add any product to the shopping cart
  2. Go to checkout
  3. Press Amazon Pay button. Customer redirected to Amazon Login page
  4. Enter correct login information. Customer redirected back to processAuthHash action
  5. Page with spinner and “You will be redirected shortly” message appears. Redirect does not start.
  6. Check console log for JS error Uncaught Error: Module name "Magento_Ui/js/lib/registry/registry" has not been loaded yet for context: _. Use require([])

Your setup

  • Magento version: 2.1.6
  • Amazon Pay Extension Version: 1.2.6
  • Magento Edition: Enterprise Cloud
  • JavaScript Console: image
  • Shop URL : n/a

Additional info and possible hot-fix

It is not possible to remove amazonPayment property from window. Because it used in current version of Widgets.js and login1.js - these files on Amazon Pay side. And so it is present there despite it was moved to registry by Extension now uses uiRegistry feature. My comment here https://github.com/amzn/amazon-payments-magento-2-plugin/commit/d5d3d9fd72eaecfa15c2ed7000287a7c806b29cf#r28753669

Hot-fix:
  1. Return back amazonPayment property to window. 2. Override amazon-widgets-loader.js and login-button-wrapper.js and correctly use dependency to uiRegistry. Or remove uiRegistry at all.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 56 (30 by maintainers)

Most upvoted comments

Thank you for the fix.

However, could you give us a clear procedure to update from latest magento update (2.2.9/2.3.2) ? Master branch is the same for 2.2.x and 2.3.x ?

We just can’t wait for next magento 2 update as it’s very critical. But the latest update of Amazon pay module is from April 5th, and this pull request is including some files that are not existing in 2.2.9 (src/Core/Model/AmazonConfig.php for example).

Thank you in advance.