Depending on the Neo4j driver used, you might get an error similar to the below ones while running certain transactions:
-
Neo4j.Driver.ClientException: Write queries cannot be performed in READ access mode.
-
Neo.ClientError.Cluster.NotALeader} {message: No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER
Such errors occur when attempting to perform a write operation in a read transaction.
Solution:
To fix the issue, please ensure you are marking READ and WRITE Transactions based on the type of operation the transaction/query performs.
Refer to the corresponding official driver's documentation to know more about transaction types.
Root cause:
When a transaction is marked as READ, it is forwarded to the Followers in the Neo4j cluster.
Unmarked transactions and WRITE transactions are sent to the Leader.
AuraDB Free and AuraDS instances are non-cluster deployments, therefore run on a single node performing both reads and writes.
All other AuraDB instances(Pro and Enterprise) are cluster deployments (for better availability) where a single Leader performs Write operations and two followers handle the Read operations.
As a result of this, the same transaction would succeed when sent to AuraDB Free and AuraDS instances but would fail when sent to other AuraDB instances.
Comments
0 comments
Please sign in to leave a comment.