Closed sergio-nunez-meneses-davi closed 3 years ago
Hi @sergio-nunez-meneses-davi .
I would like to see your code where you create connection.
Because what is strange for me, you are speaking about API but at the end error is Bolt protocol. API and Bolt are two things. Bolt is low level socket protocol used for communication while API is HTTP endpoint.
But in the error I see message "read error" which can mean you have wrong connection configuration. Therefore I'm asking for piece of code how you are creating connection.
Hi @stefanak-michal ,
Thank you for your quick reply, and I'm sorry for the misunderstanding.
Here's the requested connection:
public function __construct() {
$this->client = ClientBuilder::create()
->withDriver('bolt',
sprintf('%s://%s:%s@%s:7687', DB_PROTOCOL, DB_USER, DB_PASSWORD, DB_HOST))
->withDefaultDriver('bolt')
->build();
}
Thank you again for your help.
I'm going through your error a there is message about secure connection.
You have to tell the Bolt to use SSL. @transistive has implemented this and you can read about it here: https://github.com/neo4j-php/neo4j-php-client/wiki/Configuring-connections#bolt-configuration
Also you can check for more informations https://github.com/neo4j-php/Bolt/wiki/Connection#boltconnectionstreamsocket
That means you have to extend your code like this (not tested):
public function __construct() {
$this->client = ClientBuilder::create()
->withDriver(
'bolt',
sprintf('%s://%s:%s@%s:7687', DB_PROTOCOL, DB_USER, DB_PASSWORD, DB_HOST),
BoltConfig::create()->withSslContextOptions(['verify_peer' => true])
)
->withDefaultDriver('bolt')
->build();
}
Hi @stefanak-michal,
Thank you very much for your suggestion. Unfortunately, the method withDriver()
doesn't allow BoltConfiguration
as an argument. The previous method, addBoltConnection()
, did it.
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Argument 3 passed to Laudis\\Neo4j\\ClientBuilder::withDriver() must be an instance of Laudis\\Neo4j\\Contracts\\AuthenticateInterface or null
Do you or @transistive know how to implement this in the newer version? Thank you both again.
I'm not very familiar with @transistive library. But maybe if you use different protocol to enable SSL for Bolt. What is content of DB_PROTOCOL
? Maybe if you try bolt+s
?
Hi everyone!
Thank you, Michal, for bringing the wiki to my attention. It is out of date. You are supposed to use the bolt+s
or neo4j+s
scheme now. I think @sergio-nunez-meneses-davi already tried this. Have you had the time to try the HTTPS scheme?
If it still does not work, it might be best to schedule a call to look at the issue. As far as I am aware, SSL does work as we use it with the driver and neo4j aura.
Thanks in advance,
Ghlen
Good news!
I just solved the problem by enabling the GC Logging in the neo4j.conf file. Now everything works as expected, with both of your libraries up-to-date.
Thank you @transistive and @stefanak-michal for taking the time to answer and suggest solutions.
(By the way, DB_PROTOCOL
is exactly bolt+s
)
Perfect! bolt+s
is the preferred scheme when using a single neo4j instance over the internet! Happy graphing!
Hi everyone, newbie web developer and Neo4j user here.
We're facing an issue with Neo4j Community Edition hosted in Azure. We've developed an API that uses Laudis Neo4j PHP Client and Bolt library.
When using the API in local development, for instance, through Postman, everything works perfect. But when using the API hosted in Azure, we get HTTP status code 500 most of the time. When performing queries used in the API in Neo4j Browser, it also works.
Inspecting the debug.log file, we've found these errors and warnings:
Moreover, looking at the server logs, we've found exceptions:
We've updated both repositories' versions, but it didn't help.
Would anyone have an idea on how to solve this?
Please let me know if I didn't post this issue in the correct repository. Thank you very much in advance !