Open
Description
I have started a new project, when I added graphql
it installed version ^16.0.1
.
In my project I have a mongoose.Schema
that validates an email string, the validation itself works, but when the mutation is given an invalid entry rather than returning the validation error message, I'm getting the following error:
{
"errors": [
{
"message": "Support for returning GraphQLObjectType from resolveType was removed in [email protected] please return type name instead.",
"locations": [
{
"line": 7,
"column": 5
}
],
"path": [
"userCreateOne",
"error"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"message": "Support for returning GraphQLObjectType from resolveType was removed in [email protected] please return type name instead.",
"stacktrace": [
"GraphQLError: Support for returning GraphQLObjectType from resolveType was removed in [email protected] please return type name instead.",
" at ensureValidRuntimeType (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:816:11)",
" at completeAbstractValue (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:784:5)",
" at completeValue (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:612:12)",
" at executeField (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:477:19)",
" at executeFields (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:401:20)",
" at completeObjectValue (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:895:10)",
" at completeValue (./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:624:12)",
" at ./node_modules/.pnpm/[email protected]/node_modules/graphql/execution/execute.js:474:9",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)",
" at execute (./node_modules/.pnpm/[email protected][email protected]/node_modules/apollo-server-core/src/requestPipeline.ts:485:14)"
]
}
}
}
],
"data": {
"userCreateOne": {
"recordId": null,
"record": null,
"error": null
}
}
}
If I downgrade graphql
to ^15.5.0
, then I get a proper validation error message:
{
"data": {
"userCreateOne": {
"recordId": null,
"record": null,
"error": {
"message": "User validation failed: email: Path `email` is invalid (example.com)."
}
}
}
}
I am guessing that the composed resolver returns a GraphQLObjectType
as the resolveType
when an error occurs, and as the error points out:
Support for returning GraphQLObjectType from resolveType was removed in [email protected] please return type name instead.
Metadata
Metadata
Assignees
Labels
No labels