diff --git a/lib/errors.js b/lib/errors.js index e9502e31..eee03326 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -46,7 +46,10 @@ function defaultErrorFormatter (execution, ctx) { // it handles fastify errors MER_ERR_GQL_VALIDATION if (error.originalError?.errors) { // not all errors are `GraphQLError` type, we need to convert them - return error.originalError.errors.map(toGraphQLError) + if(Array.isArray(error.originalError.errors)){ + return error.originalError.errors.map(toGraphQLError) + } + return toGraphQLError(error.originalError.errors) } return error