mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
101 stars 52 forks source link

Environment emulation nesting is not allowed when sending invoice #551

Closed reense closed 2 years ago

reense commented 2 years ago

Describe the bug Hello,

Recently I've been getting a lot of 'Environment emulation nesting is not allowed' notices in var/log/system.log. I altered the logic that emits this message, and added a stack trace, which leads me to your Invoice sender:

#0 /data/web/releases/releases/20220802125354/vendor/magento/module-payment/Helper/Data.php(223): Magento\Store\Model\App\Emulation->startEnvironmentEmulation()
#1 /data/web/releases/releases/20220802125354/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php(186): Magento\Payment\Helper\Data->getInfoBlockHtml()
#2 /data/web/releases/releases/20220802125354/vendor/magento/module-sales/Model/Order/Email/Sender/InvoiceSender.php(136): Magento\Sales\Model\Order\Email\Sender\InvoiceSender->getPaymentHtml()
#3 /data/web/releases/releases/20220802125354/vendor/mollie/magento2/Model/Client/Payments.php(366): Magento\Sales\Model\Order\Email\Sender\InvoiceSender->send()
#4 /data/web/releases/releases/20220802125354/vendor/mollie/magento2/Model/Mollie.php(339): Mollie\Payment\Model\Client\Payments->processTransaction()
#5 /data/web/releases/releases/20220802125354/vendor/mollie/magento2/Controller/Checkout/Webhook.php(86): Mollie\Payment\Model\Mollie->processTransaction()
#6 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(58): Mollie\Payment\Controller\Checkout\Webhook->execute()
#7 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(138): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->___callParent()
#8 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(153): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->Magento\Framework\Interception\{closure}()
#9 /data/web/releases/releases/20220802125354/generated/code/Mollie/Payment/Controller/Checkout/Webhook/Interceptor.php(23): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->___callPlugins()
#10 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/Action/Action.php(111): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->execute()
#11 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch()
#12 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(138): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->___callParent()
#13 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(153): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->Magento\Framework\Interception\{closure}()
#14 /data/web/releases/releases/20220802125354/generated/code/Mollie/Payment/Controller/Checkout/Webhook/Interceptor.php(32): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->___callPlugins()
#15 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/FrontController.php(245): Mollie\Payment\Controller\Checkout\Webhook\Interceptor->dispatch()
#16 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#17 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#18 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#19 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#20 /data/web/releases/releases/20220802125354/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#21 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch()
#22 /data/web/releases/releases/20220802125354/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#23 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch()
#24 /data/web/releases/releases/20220802125354/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#25 /data/web/releases/releases/20220802125354/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#26 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#27 /data/web/releases/releases/20220802125354/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#28 /data/web/releases/releases/20220802125354/pub/index.php(30): Magento\Framework\App\Bootstrap->run()

I'm unsure if this is a bug caused by your module, or that it's a Magento core bug. However, since the area code cannot be properly set, translations will not be loaded properly.

Used versions

To Reproduce

  1. Install the module + configure it correctly
  2. Use webhooks + enable sending the invoice sending after payment confirmation
  3. Place an order and wait for the invoice to be sent
  4. View the log (var/log/system.log, when using production).

Expected behavior No error is thrown, preventing environment emulation.

Actual behavior Emulation emulation is prevented because an environment is already emulated.

Frank-Magmodules commented 2 years ago

Hello @reense,

Thanks for opening this issue. 

We investigated this message before (see #534) and we concluded that this is caused by a Magento bug, see this issue for more info: magento/magento2#35603. 

This isn’t something we can’t fix on our side so we are going to close this issue, but feel free to reopen if you have any further questions.

reense commented 2 years ago

Hey @Frank-Magmodules ! Thank you for reaction. Sorry, I hadn't seen that issue, I've must've not searched properly 🙂. I'll keep an eye out for that Magento issue!