Call to undefined method GuzzleHttp\Utils::chooseHandler() when sending email

Viewed 4784

My application was working fine and when I woke up today i faced this error:

Call to undefined method GuzzleHttp\Utils::chooseHandler(

/opt/bitnami/apache/htdocs/php/plain/vendor/guzzlehttp/guzzle/src/HandlerStack.php:42

function choose_handler(): callable
    
    {
    
        return Utils::chooseHandler();
    
    }

This is when the error happens:

Mail::to($request->email)->send(new ProfessionalInvited($clinic, $person, $inviteId));

What could happened? And what should I do? I already tried deleting my vendor and composer.lock and reinstall everything. But without success. I was also having this error in API calls using guzzle and when I changed to cURL everything worked fine. But I dont think I can do the same to send emails since Guzzle is a dependency.

1 Answers

Hard to say what exactly happened but I can guess:

  1. You installed wrong Guzzle version and it does not have chooseHandler method in Utils class (or it was reinstalled somehow on server).
  2. Somehow file was removed
  3. There was some problem with composer and you should run composer dump-autoload

I verified it and this method and class exists in Guzzle 7.x version and it's also mentioned in documentation.

Related