magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.58k stars 9.32k forks source link

Braintree Module needs to be enabled to add items to cart? #12908

Closed zack6849 closed 6 years ago

zack6849 commented 6 years ago

Preconditions

  1. Magento v2.1.0
  2. PHP v7.0.14 (Not version specific, I don't think)

Steps to reproduce

  1. Disable Magento_Braintree
  2. Rebuild / recompile etc
  3. Try to add item to cart

Expected result

  1. Item is added to cart

Actual result

  1. Add to cart fails, greeted with 500 error, claiming it can't find the class 'BraintreeFacade' Which obviously makes sense, because the module is disabled, but why is it still trying to create that payment method?
PHP Fatal error:  Uncaught Error: Class 'BraintreeFacade' not found in /home/acme/www_magento2/development/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:93
Stack trace:
#0 /home/acme/www_magento2/development/vendor/magento/framework/ObjectManager/Factory/Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('BraintreeFacade', Array)
#1 /home/acme/www_magento2/development/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('BraintreeFacade', Array)
#2 /home/acme/www_magento2/development/vendor/magento/module-payment/Model/Method/Factory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('BraintreeFacade', Array)
#3 /home/acme/www_magento2/development/vendor/magento/module-payment/Helper/Data.php(112): Magento\Payment\Model\Method\Factory->create('BraintreeFacade')
#4 /home/acme/ in /home/acme/www_magento2/development/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 93

As expected, re-enabling the Magento_Braintree module makes the system work again.

YevSent commented 6 years ago

@zack6849, did you clear var/generation and cache?

zack6849 commented 6 years ago

Yes, when I disable the module, I run the following command before testing again: rm -rf var/cache/* var/generation/* var/page_cache/* var/di/* var/view_preprocessed/*; bin/magento cache:flush; bin/magento setup:upgrade; bin/magento setup:di:compile; bin/magento setup:static-content:deploy

YevSent commented 6 years ago

Seems, some cache still exists. I've checked on the latest 2.1-develop branch, all works as expected, the Braintree module can be safely disabled.

zack6849 commented 6 years ago

Is that equivalent to 2.1.10?

I don't see any way some cache could still exist, it seems to be pretty easily reproducible on my end even though i clear all the cache files, and explicitly run the magento cache:flush command

YevSent commented 6 years ago

No, because at least latest 2.1.x release is 2.1.11, the 2.1-develop branch contains more fixes than previous versions.

zack6849 commented 6 years ago

I updated our installation to 2.1.11 and we're still seeing the same issue :/

magento-engcom-team commented 6 years ago

@zack6849 , thank you for your report. We are not able to reproduce this issue by the steps which you provided. Please, try to reproduce this problem on clean Magento installation or provide more additional information? Maybe are you using some third-party extensions?

zack6849 commented 6 years ago

Seems to be related to version 2.4.1 of the Dotmailer extension.

Issue created at https://github.com/dotmailer/dotmailer-magento2-extension/issues/494

You guys may want to confirm this issue doesn't happen on 2.2.x, since from what I understand the dotmailer extension is now bundled with magento?

magento-engcom-team commented 6 years ago

@zack6849, thank you for your report. We've created internal ticket(s) MAGETWO-86247 to track progress on the issue.

dmanners commented 6 years ago

@zack6849 are you able to use xdebug to see what is calling getMethodInstance with the Braintree payment option? https://github.com/magento/magento2/blob/2.1-develop/app/code/Magento/Payment/Helper/Data.php#L101 It would help out massively to know the entry point into this call.

Thanks

zack6849 commented 6 years ago

@dmanners I can't do that at the moment, but it looks like the dotmailer team know what the issue is, maybe contact them? They responded to my ticket https://github.com/dotmailer/dotmailer-magento2-extension/issues/494

ishakhsuvarov commented 6 years ago

@zack6849 @dmanners @joni-jones Thank you for investigation. Closing this ticket for now, as the issue seems to originate from different vendor.