React Message Board Tutorial: Error on Submitting Post

I’ve been following the Slash GraphQL React Message Board tutorial. On the last step, after setting up the functionality to submit a post, and then writing a post and pressing submit, an Apollo Client error appears (screenshot attached).

I’m running the site on localhost. Other than this error, data is successfully queried and displayed in the app from the Slash GraphQL backend I set up. I’m not sure how to begin trying to make sense of this error, as it doesn’t seem to be coming directly from any of the code written in the tutorial.

1 Like

Hi @davey561,

Sorry this is a last-minute cut and past error on my part. Generally GraphQL gives really good errors, but what you are seeing there (from Apollo client) isn’t that helpful. The key bit at the top is “unknown field”.

That’s cause in the mutation to add the post, I had likes: 0, but that’s bogus, cause that’s not in the schema … it’s in the full app, but not what’s in the tutorial so far. So I guess I cut and pasted the wrong thing at one point.

I’ve patched the tutorial website (and the GitHub repo). Note that I tweaked the schema at https://dgraph.io/learn/courses/messageboardapp/react/develop/graphql/graphql-schema/ (adding the tags field) and tweaked the mutations page https://dgraph.io/learn/courses/messageboardapp/react/develop/react/graphql-mutations/ to remove the error.

Hope that fixes things for you. If not, get back in touch and I’ll see what else I broke :grimacing:

3 Likes

That solved it! Thanks, Michael.

1 Like