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

Invalid input '_filter' #207

Open
DomVinyard opened this issue May 27, 2021 · 0 comments
Open

Invalid input '_filter' #207

DomVinyard opened this issue May 27, 2021 · 0 comments

Comments

@DomVinyard
Copy link

DomVinyard commented May 27, 2021

We are using this library in conjunction with Neo4j Aura. Today an update to Aura broke our app in production. It remains broken still, several hours later. I have copied this issue from our internal tracker.

This appears to be a bug in the (now unsupported) Neo4j GraphQL library.

When we write a query in GraphQL such as:

query {
    Person {
       contributions(filter: { date: { year: 2021 } }) {
         contributionID
     }
  }
} 

neo4j-graphql transforms it into a Cypher query that looks like this (truncated):

:params { "offset": 0, "first": -1, "1_filter": { "date": { "year": 2021 } } }

MATCH (person:Person)-[:PERSON_CONTRIBUTION]-(contribution:Contribution)
WHERE contribution.date.year = $1_filter.date.year
RETURN contribution

This Cypher query above throws an Error when talking to Aura. This is no longer a valid cypher query.

Why?

The problem appears to be that the autogenerated filter key begins with an Integer.

If I manually extract the generated cypher query but prepend the filter to begin with a non-integer, and then run it locally, it works fine.

// FAILS
:params { "1_filter": "hello world" }

// OK
:params { "_1_filter": "hello world" }

Solution

I will file this ticket with Neo4j but since the library is unsupported we have to assume that this might not be fixed. And even if it is fixed, something like this might happen again.

Solutions include:

  1. Fork the library and fix it ourselves by prepending something to the filter keyword. (Maybe in this file?)
  2. Switch over to the new supported neo4j-graphql library. We'd need a spike to determine how big a migration this is.
  3. Abandon Neo4j in favour of a more stable alternative (Prisma). If we are doing a migration to the new library anyway (if the spike above shows that this is non-trivial) then this might be a good opportunity to cut our losses.
  4. Abandon Aura but retain Neo4j. Aura automatically updates the DB, presumably if we run our own (old) version of Neo4j this query would still be supported (Not a good idea, included for the sake of completeness).
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

1 participant