馃悰 [Bug] Post mutations crash on nested resolvers
Created by: Tirokk
Authored by roschaefer Closed
馃悰 Bugreport
The posts resolvers do not use the ...Resolver()
helper like the user resolvers do. Without neo4j-graphql-js
this will lead to Resolve function ... returned undefined
errors.
Steps to reproduce the behavior
- Get your JWT and an ID of one of your posts
- Try to update your post:
mutation($id: ID!, $title: String! $content: String!) {
UpdatePost(id: $id, title: $title, content: $content, categoryIds: ["5a6638a0c64291000bf30291"]) {
title
content
author {
name
}
}
}
- See error:
{
"errors": [
{
"message": "Resolve function for \"Post.author\" returned undefined",
"locations": [
{
"line": 5,
"column": 5
}
],
"path": [
"UpdatePost",
"author"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": {
"UpdatePost": {
"title": "updated title",
"content": "Updated content",
"author": null
}
}
}
Expected behavior
The author
response field should have my name.
Additional context
Check out the Resolver
helper:
https://github.com/Human-Connection/Human-Connection/blob/master/backend/src/schema/resolvers/helpers/Resolver.js
and how it's used:
https://github.com/Human-Connection/Human-Connection/blob/master/backend/src/schema/resolvers/users.js