The following test case (assuming correct password)
<?php
require_once "vendor/autoload.php";
use GraphAware\Neo4j\Client\ClientBuilder;
$client = ClientBuilder :: create() -> addConnection("default", "http://neo4j:Password@localhost:7474") -> build();
$query = "MATCH (u:User)
RETURN u";
$result = $client -> run($query);
$user = $result -> firstRecord() -> values()[0];
?>
gives me the following error:
PHP Fatal error: Uncaught GuzzleHttp\\Exception\\ClientException: Client error: `POST http://neo4j:***@localhost:7474/db/data/transaction/commit` resulted in a `400 Bad Content-Type header value: ''` response in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\\Exception\\RequestException::create(Object(GuzzleHttp\\Psr7\\Request), Object(GuzzleHttp\\Psr7\\Response))
#1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(Object(GuzzleHttp\\Psr7\\Response))
#2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\\Promise\\Promise::callHandler(1, Object(GuzzleHttp\\Psr7\\Response), Array)
#3 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}()
#4 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\\Promise\\TaskQueue->run(true)
#5 /var/www/html/vendor/guzzlehttp/ in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113, referer: http://localhost/
I don't know how to interpret this or what is wrong.
-
My database is running properly in the neo4j browser client.
-
As far as I know graphaware is installed appropriately, as per the instructions on the website.
-
I have tested and the error occurs at the point of running the query, not at the point of creating the client (even though this is not indicated clearly by the error).
-
If I copy / paste the query directly into the neo4j browser client then it works as expected.
Any idea why I am getting this error?
from Neo4j PHP Graphaware '400 Bad Content-Type header' error
You're not alone with this error message. If you figure out why it's doing this, please let us know.
ReplyDelete