Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

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

Open
dan-fein opened this issue Jan 28, 2021 · 5 comments
Open

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

dan-fein opened this issue Jan 28, 2021 · 5 comments

Comments

@dan-fein
Copy link

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
Copy link

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
Copy link

NawarA commented Mar 24, 2021

Also running into the same issue

@mattmurph9
Copy link

Same issue

@henrygeddes
Copy link

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)
#607

@michaeldgraham
Copy link
Collaborator

#608

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

No branches or pull requests

5 participants