You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guzzle is truncating validation errors making it extremely difficult to debug. This seems to be an issue when Guzzle is configured to throw exceptions on errors. I have traced the problem down to Requester.php and was able to output the message by printing the message body contents.
this is indeed annoying, but it's a problem with GuzzleHttp. You can avoid it by supplying an instance which is configured not to do so. Here's an example with the Contentful library based on this comment:
// First, create the Guzzle HTTP client
$stack = new \GuzzleHttp\HandlerStack(\GuzzleHttp\Utils::chooseHandler());
$stack->push(\GuzzleHttp\Middleware::httpErrors(new \GuzzleHttp\BodySummarizer(PHP_INT_MAX)), 'http_errors');
$stack->push(\GuzzleHttp\Middleware::redirect(), 'allow_redirects');
$stack->push(\GuzzleHttp\Middleware::cookies(), 'cookies');
$stack->push(\GuzzleHttp\Middleware::prepareBody(), 'prepare_body');
$httpClient = new \GuzzleHttp\Client(['handler' => $stack ]);
// Next, create Contentful client options and set the HTTP client
$options = \Contentful\Delivery\ClientOptions::create()->withHttpClient($httpClient);
// Finally create the client with the options
$client = new \Contentful\Delivery\Client( 'b4c0n73n7fu1', 'cfexampleapi', 'master', $options);
Guzzle is truncating validation errors making it extremely difficult to debug. This seems to be an issue when Guzzle is configured to throw exceptions on errors. I have traced the problem down to Requester.php and was able to output the message by printing the message body contents.
contentful-core.php/src/Api/Requester.php
Line 84 in 446826d
Example of Truncated Error
The text was updated successfully, but these errors were encountered: