amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
109 stars 77 forks source link

Exception in admin after installation #1104

Closed splendidinternet closed 2 years ago

splendidinternet commented 2 years ago

What I expected

I can edit the amazon pay configuration in the admin.

What happened instead

I get an exception when opening the amazon pay configuration in the admin with this trace:

Error: Object of class Magento\Framework\Profiler\Driver\Standard\Stat could not be converted to string in /var/www/html/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php:480
Stack trace:
#0 /var/www/html/vendor/phpseclib/phpseclib/phpseclib/Crypt/RSA.php(480): phpinfo()
#1 /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Model/Config/AutoKeyExchange.php(277): phpseclib\Crypt\RSA->__construct()
#2 /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Model/Config/AutoKeyExchange.php(329): Amazon\Pay\Model\Config\AutoKeyExchange->generateKeys()
#3 /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Model/Config/AutoKeyExchange.php(524): Amazon\Pay\Model\Config\AutoKeyExchange->getPublicKey()
#4 /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Model/Config/AutoKeyExchange.php(617): Amazon\Pay\Model\Config\AutoKeyExchange->getFormParams()
#5 /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Block/Adminhtml/System/Config/AutoKeyExchangeAdmin.php(45): Amazon\Pay\Model\Config\AutoKeyExchange->getJsonAmazonAKEConfig()
#6 /var/www/html/var/view_preprocessed/pub/static/vendor/amzn/amazon-pay-magento-2-module/view/adminhtml/templates/system/config/autokeyexchange_admin.phtml(1): Amazon\Pay\Block\Adminhtml\System\Config\AutoKeyExchangeAdmin->getJsonCon
#7 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(71): include('/var/www/html/v...')
…

Steps to reproduce the issue

I've installed the amazon pay extension via composer following this guide: https://amzn.github.io/amazon-payments-magento-2-plugin/installation.html

Your setup

sgabhart22 commented 2 years ago

Hello @splendidinternet ,

Would you happen to have the module mirasvit/module-profiler installed on your system? I was able to reproduce your error after installing that module and enabling the profiler. There seems to be a very specific conflict with it module and generating RSA keys with phpseclib. What's more, disabling the profiler module was not enough to resolve the error; I had to go as far as removing the module entirely and recompiling.

Please let us know if this is helpful!

splendidinternet commented 2 years ago

@sgabhart22 Yes, this solved our problem. Thank you very much!