I'm using react with Apollo and a F# backend.
When i make a query i get an error similar to this but i'm not sure why as it seems like stories is present in the response.
Missing field stories in "{\"stories\":[{\"name\":\"Story1\",\"__typename\":\"Story\"},{\"name\":\"Story2\",\"__typename\":\
My code for making the query is:
const client = new ApolloClient({
uri: '/graphql',
});
client
.query({
query: gql`
query testStoryQuery
{
stories
{
name
}
}
`
})
.then(result => console.log(result));
Finally the raw response returned by the server is:
{"data":"{\"stories\":[{\"name\":\"Story1\",\"__typename\":\"Story\"},{\"name\":\"Story2\",\"__typename\":\"Story\"},{\"name\":\"Story3\",\"__typename\":\"Story\"}]}"}
The only thing I've tried so far is jsonifying the response (i.e. the ") around fields, but it doesn't seem to find the field either way.
Update (extra info)
The full stack trace
Any help would be appreciated, i'll continue working on it in the meantime.
Thank you :)
Bad response format:
{"data":____"____{\"stories\":[{\"name\":\"Story1\",\"__typename\":\"Story\"},{\"name\":\"Story2\",\"__typename\":\"Story\"},{\"name\":\"Story3\",\"__typename\":\"Story\"}]}____"____}
This way data is a string, not object.
Also bad names \r\n\t\t\t\t__typename
in a stack trace.
For more details run some working example (any apollo client project) and compare arguments passed to writeToStore.ts
methods using browser debugger breakpoints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With