llegal struct size: Expected struct to be 3 fields but got 1
aniketfuryrocks opened this issue · comments
use anyhow::bail;
use neo4rs::Graph;
use crate::{NEO4J_PASS, NEO4J_URL, NEO4J_USER};
pub struct AppState {
pub graph: Graph,
}
impl AppState {
pub async fn new() -> anyhow::Result<Self> {
let this = match Graph::new(NEO4J_URL, NEO4J_USER, NEO4J_PASS).await {
Ok(graph) => Self { graph },
Err(err) => {
return bail!("Error creating graph instance in app state {err:?}");
}
};
let mut result = this
.graph
.execute(neo4rs::query("MATCH (p:Person {name: $name}) RETURN p").param("name", "Mark"))
.await
.unwrap();
Ok(this)
}
}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnexpectedMessage("unexpected response for RUN: Ok(FailureMessage(Failure { metadata: BoltMap { value: {BoltString { value: \"code\" }: String(BoltString { value: \"Neo.ClientError.Request.InvalidFormat\" }), BoltString { value: \"message\" }: String(BoltString { value: \"Illegal struct size: Expected struct to be 3 fields but got 1\" })} } }))")', src\api\app_state.rs:23:14
docker run --name global_graph_neo -p 7474:7474 -p 7687:7687 -e "NEO4J_AUTH=neo4j/password" neo4j
OS:
windows 11
Hi @aniketfuryrocks, which Neo4j version are you using? Based on the docker command, I would guess the latest one, so some Neo4j 5.x. This driver is not yet compatible with the 5.x series, see #24.
Thanks for the response. We'll switch back to 4.4.
Although this only results in an error, I think the signature of the Run
struct is wrong irregardless. B1
is a struct with 1 field, but run has 3. Changing this at least runs the tests without problems on 4.4 and 5 (see #64).