Exception: Call to undefined method GuzzleHttp\Utils::chooseHandler()

Hello Mark, last version of Commerce 1.2.1 (was updated from 1.2.0-rc5)
I create new Mollie payment method and after that get this:


A fatal error occurred generating the page

Exception: Call to undefined method GuzzleHttp\Utils::chooseHandler()

    #0 /home/s26208/www/core/components/commerce/vendor/guzzlehttp/guzzle/src/HandlerStack.php(42): GuzzleHttp\choose_handler()
    #1 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/HttpAdapter/Guzzle6And7MollieHttpAdapter.php(50): GuzzleHttp\HandlerStack::create()
    #2 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/HttpAdapter/MollieHttpAdapterPicker.php(22): Mollie\Api\HttpAdapter\Guzzle6And7MollieHttpAdapter::createDefault()
    #3 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/MollieApiClient.php(273): Mollie\Api\HttpAdapter\MollieHttpAdapterPicker->pickHttpAdapter()
    #4 /home/s26208/www/core/components/commerce/src/Gateways/Mollie.php(55): Mollie\Api\MollieApiClient->__construct()
    #5 /home/s26208/www/core/components/commerce/model/commerce/compaymentmethod.class.php(139): modmore\Commerce\Gateways\Mollie->__construct()
    #6 /home/s26208/www/core/components/commerce/src/Admin/Configuration/PaymentMethods/Form.php(101): comPaymentMethod->getGatewayInstance()
    #7 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(146): modmore\Commerce\Admin\Configuration\PaymentMethods\Form->getFields()
    #8 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(194): modmore\Commerce\Admin\Widgets\FormWidget->_getFields()
    #9 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(59): modmore\Commerce\Admin\Widgets\FormWidget->generateForm()
    #10 /home/s26208/www/core/components/commerce/src/Admin/Section.php(54): modmore\Commerce\Admin\Widgets\FormWidget->generate()
    #11 /home/s26208/www/core/components/commerce/src/Admin/Page.php(108): modmore\Commerce\Admin\Section->generate()
    #12 /home/s26208/www/core/components/commerce/src/Admin/Generator.php(119): modmore\Commerce\Admin\Page->generate()
    #13 /home/s26208/www/core/components/commerce/controllers/index.class.php(48): modmore\Commerce\Admin\Generator->generate()
    #14 /home/s26208/www/core/model/modx/modmanagercontroller.class.php(157): CommerceIndexManagerController->process()
    #15 /home/s26208/www/core/model/modx/modmanagerresponse.class.php(79): modManagerController->render()
    #16 /home/s26208/www/core/model/modx/modmanagerrequest.class.php(190): modManagerResponse->outputContent()
    #17 /home/s26208/www/core/model/modx/modmanagerrequest.class.php(138): modManagerRequest->prepareResponse()
    #18 /home/s26208/www/manager/index.php(59): modManagerRequest->handleRequest()
    #19 {main}

Also I run update composer in core/components/commerce folder (after get error), but this did not help…

Please do not ever do this unless instructed to by support!!! That will potentially install versions of dependencies that we’ve not yet tested and can cause even more issues. A composer install is less harmful but will also get run for you during the installation as of 1.2.1, so is unlikely to have any effect.

Can you download and install the guzzle7 package (available from modx) and see if that helps? That will make the latest version of guzzle globally available (and force it to be loaded into memory) to try and avoid guzzle conflicts.

In Commerce 1.3 we’ll start depending on that package directly and will no longer ship Guzzle with Commerce, but as that requires a minimum PHP version bump that’s not something we could do for 1.2.1.

If this is MODX3 (< alpha4) the guzzle7 package may not yet force loading it into memory and you’ll need v1.1 of that package which I’ll try to release today. If it’s on your custom 3 build I’m not sure if that already included the container?

Installed. I think same error?

#0 /home/s26208/www/core/components/commerce/vendor/guzzlehttp/guzzle/src/HandlerStack.php(42): GuzzleHttp\choose_handler()
#1 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/HttpAdapter/Guzzle6And7MollieHttpAdapter.php(50): GuzzleHttp\HandlerStack::create()
#2 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/HttpAdapter/MollieHttpAdapterPicker.php(22): Mollie\Api\HttpAdapter\Guzzle6And7MollieHttpAdapter::createDefault()
#3 /home/s26208/www/core/components/commerce/vendor/mollie/mollie-api-php/src/MollieApiClient.php(273): Mollie\Api\HttpAdapter\MollieHttpAdapterPicker->pickHttpAdapter()
#4 /home/s26208/www/core/components/commerce/src/Gateways/Mollie.php(55): Mollie\Api\MollieApiClient->__construct()
#5 /home/s26208/www/core/components/commerce/model/commerce/compaymentmethod.class.php(139): modmore\Commerce\Gateways\Mollie->__construct()
#6 /home/s26208/www/core/components/commerce/src/Admin/Configuration/PaymentMethods/Form.php(101): comPaymentMethod->getGatewayInstance()
#7 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(146): modmore\Commerce\Admin\Configuration\PaymentMethods\Form->getFields()
#8 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(194): modmore\Commerce\Admin\Widgets\FormWidget->_getFields()
#9 /home/s26208/www/core/components/commerce/src/Admin/Widgets/FormWidget.php(59): modmore\Commerce\Admin\Widgets\FormWidget->generateForm()
#10 /home/s26208/www/core/components/commerce/src/Admin/Section.php(54): modmore\Commerce\Admin\Widgets\FormWidget->generate()
#11 /home/s26208/www/core/components/commerce/src/Admin/Page.php(108): modmore\Commerce\Admin\Section->generate()
#12 /home/s26208/www/core/components/commerce/src/Admin/Generator.php(119): modmore\Commerce\Admin\Page->generate()
#13 /home/s26208/www/core/components/commerce/controllers/index.class.php(48): modmore\Commerce\Admin\Generator->generate()
#14 /home/s26208/www/core/model/modx/modmanagercontroller.class.php(157): CommerceIndexManagerController->process()
#15 /home/s26208/www/core/model/modx/modmanagerresponse.class.php(79): modManagerController->render()
#16 /home/s26208/www/core/model/modx/modmanagerrequest.class.php(190): modManagerResponse->outputContent()
#17 /home/s26208/www/core/model/modx/modmanagerrequest.class.php(138): modManagerRequest->prepareResponse()
#18 /home/s26208/www/manager/index.php(59): modManagerRequest->handleRequest()

If it’s on your custom 3 build I’m not sure if that already included the container?
Yes it is on Sterc Modx3 build…

What do U think ? Should I restore backup before composer update and install Guzzle7 again ?

Btw, I check another site.
Update Commerce,
DO NOT UPDATE COMPOSER)
install Guzzle7

Installing ‘unzip’ or ‘7z’ may remediate them.
- Downloading psr/http-message (1.0.1)
- Downloading psr/http-client (1.0.1)
- Downloading ralouphie/getallheaders (3.0.3)
- Downloading psr/http-factory (1.0.1)
- Downloading guzzlehttp/psr7 (2.0.0)
- Downloading guzzlehttp/promises (1.4.1)
- Downloading guzzlehttp/guzzle (7.3.0)
- Installing psr/http-message (1.0.1): Extracting archive
- Installing psr/http-client (1.0.1): Extracting archive
- Installing ralouphie/getallheaders (3.0.3): Extracting archive
- Installing psr/http-factory (1.0.1): Extracting archive
- Installing guzzlehttp/psr7 (2.0.0): Extracting archive
- Installing guzzlehttp/promises (1.4.1): Extracting archive
- Installing guzzlehttp/guzzle (7.3.0): Extracting archive
2 package suggestions were added by new dependencies, use composer suggest to see

An have same problem =(

I’ve just released a guzzle7 update (v7.3.0), can you try that? That should pre-load the relevant classes more reliably to avoid conflicting dependencies from breaking things…

You Are The Best Mark! :grinning:
Works on both sites!
(at least I can Open popup window - but will check all steps tomorrow)

Hi,

I ran into the same issue with MODX3 and this was fixed by installing Commerce 1.3.0-dev6. Is this version stable for production? Or should I install 1.2.X and then install Guzzle7 seperately?
Tnx, Steffan

The 1.3 dev builds are not yet meant for production, and are still receiving updates without a separate changelog. As soon as we release 1.3.0-rc1 that’s okay. That wont be long.

1.3 just installs guzzle7 by default, so the fix is identical.

Thanks for the quick reply! I’ll wait a little longer then, no problem :slight_smile: