neo4j-graphql / neo4j-graphql-js

NOTE: This project is no longer actively maintained. Please consider using the official Neo4j GraphQL Library (linked in README).
Other
608 stars 148 forks source link

[Error: No such field: __typename] when using orderBy #581

Open dan-fein opened 3 years ago

dan-fein commented 3 years ago

When I'm not using orderBy my query is fine, however when using it my query like below it's appending __typename to the query (it's supposed to be a DateTime) and then returning an error because it doesn't exist.

Any ideas?

Also out of curiousity is this repo actively maintained?

query get_rooms($id: ID!) {
  User (id: $id) {
    rooms(orderBy: latest_message_desc) {
      id
      latest_message {
        formatted
      }
      things(first:3){
        id
        name
        image
      }
    }
  }
}
henrygeddes commented 3 years ago

I've also run into this same issue, neo4j-graphql-js: ^2.19.2 apollo-server: ^2.20.0 neo4j:4.1.1 (Docker)

Tested through GraphQLPlayground and ApolloClient Attempting to orderBy on a neo4jdatetime (as well as querying for the same property)

E.g.

{
  Cart {
     Items(orderBy: lastUpdatedDate_desc) {
       id
       lastUpdatedDate { formatted }
    }
  }
}

Through ApolloClient (with typename's added automatically to queries) we received "No such field: typename" The same issue when querying through GraphQLPlayground with typename added to the query

No issue when disabling automatic __typename (through ApolloClient) or not adding it to the GraphQLPlayground Query Similarly we had no issue when NOT querying for lastUpdatedDate (but still using it in orderBy)

NawarA commented 3 years ago

Also running into the same issue

mattmurph9 commented 3 years ago

Same issue

henrygeddes commented 3 years ago

I have found a workaround and created a PR. Not sure this is a proper fix (haven't spent the time properly looking into it / testing) https://github.com/neo4j-graphql/neo4j-graphql-js/pull/607

michaeldgraham commented 3 years ago

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608