Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem writing to 4.1x #137

Open
mbouclas opened this issue Sep 2, 2020 · 7 comments
Open

Problem writing to 4.1x #137

mbouclas opened this issue Sep 2, 2020 · 7 comments

Comments

@mbouclas
Copy link

mbouclas commented Sep 2, 2020

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?

@adam-cowley
Copy link
Owner

It looks like you're trying to write to the database within a read session. Can I see your code?

@mbouclas
Copy link
Author

mbouclas commented Sep 2, 2020

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

@adam-cowley
Copy link
Owner

.session open a read session by default, try this instead:

 this.neo.writeCypher(query, {
   ...issue, ...{uuid}
});

@mbouclas
Copy link
Author

mbouclas commented Sep 2, 2020

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

@adam-cowley
Copy link
Owner

adam-cowley commented Sep 2, 2020

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.

@mbouclas
Copy link
Author

mbouclas commented Sep 2, 2020

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

@adam-cowley
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants