I’m having an issue getting graphql queries working outside of the playground. My app is built in react using apollo-client. fauna is returning the following response to my request
{"data":null,"errors":[{"message":"Must provide schema definition with query type or a type named Query."}]}
The query itself is fine, works a treat in the Playground (sorry for horrible formatting from console…)
query: "{↵ allTracks {↵ data {↵ title↵ main_artists {↵ data {↵ name↵ __typename↵ }↵ __typename↵ }↵ composers {↵ data {↵ name↵ __typename↵ }↵ __typename↵ }↵ links {↵ data {↵ url↵ __typename↵ }↵ __typename↵ }↵ __typename↵ }↵ __typename↵ }↵}↵" variables: {}
At a bit of a loss as to what this error means. I do have the query allTracks in my schema. Help would be much appreciated! None of the valid variations make a difference…
query: GetAllTracks { allTracks ... query: { allTracks ...
The full query in the code, wrapped by gql formatted is
export const GET_ALL_TRACKS = gql query { allTracks { data { title main_artists { data { name } } composers { data { name } } links { data { url } } } } }
The implemention for the query uses the apollo-client useQuery hook.
const { loading, error, data } = useQuery(GET_ALL_TRACKS,{errorPolicy: 'all'});