Problem writing to 4.1x
mbouclas opened this issue · 7 comments
Upgraded to 4.1x (tried most of the minor updated all the way to 4.1.1) causes the following error any time a write is attempted
Neo4jError: Writing in read access mode not allowed. Attempted write to internal graph 0
Using the Neo4J browser works just fine. Downgrading to 4.0.x also works just fine.
Anyone else had this?
It looks like you're trying to write to the database within a read session. Can I see your code?
The same code though works on 4.0x.
In any case, it's a cypher query run like so
try {
res = await this.neo.cypher(query, {
...issue, ...{uuid}
});
}
catch (e) {
console.log(e);
}
and the driver error on the catch
code: 'Neo.ClientError.Statement.AccessMode',
name: 'Neo4jError',
query: 'MATCH (issue:Issue {uuid:$uuid})\n SET issue.description = ' +
'$description, issue.issue = $issue, issue.issueType = $issueType, ' +
'issue.active = $active\n \n WITH issue\n \n ' +
'RETURN *;',
Is there some sort of config that tells the driver to go into write mode on 4.1x? If so, is it set on the env? I couldn't find anything on the documentation. This code worked for some time now, it's just that we decided to upgrade the actual DB to 4.1
.session
open a read session by default, try this instead:
this.neo.writeCypher(query, {
...issue, ...{uuid}
});
This throws a different error, Neo4j only supports a subset of Cypher types for storage as singleton or array properties
.
It would require quite a rewrite on our part anyways so not sure how practical it would be.
btw, thank you for taking the time
This will depend on the data held in issue
and uuid
. It looks like you're trying to store something that Neo4j doesn't support as a property type - possibly an array somewhere inside issue
or a native javascript type isn't being converted somewhere?
From the docs:
Property types comprise:
- Number, an abstract type, which has the subtypes Integer and Float
- String
- Boolean
- The spatial type Point
- Temporal types: Date, Time, LocalTime, DateTime, LocalDateTime and Duration
Homogeneous lists of simple types can also be stored as properties, although lists in general (see Composite types) cannot be stored.
https://neo4j.com/docs/cypher-manual/current/syntax/values/#property-types
If you update the properties through the OGM it'll take care of the conversion for you.
Can you create a repository that replicates the issue? That way I can advise how to fix the problem or if there is a bug in neo4j or the driver itself I can pass it on to the correct people to get it fixed.
After some digging around it looks that it's a driver issue. Same code and payload react differently the moment you change the DB version. So for now it seems upgrading is a no go cause of the extend of the rewrites required
Can you link me to a repo that replicate the issue? If it's a driver/database issue then I can pass it on to the right people to make sure it's safe for you to upgrade and stop others from running into the same problem.