GuzzleHttp\Exception\RequestException, TypeError given
michaelschuetz opened this issue · comments
Hi,
we do get this exception:
[2023-07-10 04:36:47] production.ERROR: HubSpot\RetryMiddlewareFactory::HubSpot\{closure}(): Argument #4 ($exception) must be of type ?GuzzleHttp\Exception\RequestException, TypeError given, called in /data/www/hubspot.company123.de/releases/2023-06-06_114218/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php on line 99 {"exception":"[object] (TypeError(code: 0): HubSpot\\RetryMiddlewareFactory::HubSpot\\{closure}(): Argument #4 ($exception) must be of type ?GuzzleHttp\\Exception\\RequestException, TypeError given, called in /data/www/hubspot.company123.de/releases/2023-06-06_114218/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php on line 99 at /data/www/hubspot.company123.de/releases/2023-06-06_114218/vendor/hubspot/api-client/lib/RetryMiddlewareFactory.php:89)
[stacktrace]
--> https://github.com/HubSpot/hubspot-api-php/blob/master/lib/RetryMiddlewareFactory.php#L89
--> straigt from hubspot live
--> pls check
thx and best
Michael
Hi @michaelschuetz .
Could you share your php version, the SDK version and guzzle version , please?
"php": "8.2",
"guzzlehttp/guzzle": "7.7",
"hubspot/api-client": "10.1",
Thx,
Michael
I've just checked it one more time and I can't reproduce it.
Workable sample app
Maybe something incorrect on your side.
I can confirm that this is an issue. You can reproduce this by breaking your DNS in a docker instance for example. Connectivity issues will also throw TypeError's resulting in failing closures in vendor/hubspot/api-client/lib/RetryMiddlewareFactory.php
.
The request we used, although I don't think in our case is relevant, is vendor/hubspot/api-client/lib/Discovery/Discovery.php
with ->crm()->contacts()->searchApi();
and a filter with some valid data.
Current versions:
php
at8.2.8
guzzlehttp/guzzle
at7.8.0
hubspot/api-client
at10.1.0
I hacked closures that accept all to expose the underlaying issue:
So, in vendor/hubspot/api-client/lib/RetryMiddlewareFactory.php
the methods getRetryFunctionByRange()
and getRetryFunction()
gets fed a $exception
argument value it doesn't like.