I am having some problem with the error merging. Maybe this is intended behaviour but seems wrong.
It works fine when I query for a single type within the query, for example:
The schema:
type Me {
basket: Basket
order(id: ID!): Order
customer: Customer
}
type Query {
me: Me!
}
The query:
query {
me {
basket {
id
}
}
}
The response looks perfect, correct error message, code, etc.
{
"errors": [
{
"message": "The request has not been Authenticated",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"me",
"basket"
],
"extensions": {
"code": "UNAUTHENTICATED",
"exception": {
"message": "The request has not been Authenticated",
"stacktrace": [
"GraphQLError: The request has not been Authenticated",
" at Object.combineErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:101:16)",
" at Object.handleErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/checkResultAndHandleErrors.js:118:44)",
" at defaultMergedResolver (/var/task/node_modules/graphql-tools-fork/dist/stitching/defaultMergedResolver.js:23:63)",
" at resolveFieldValueOrError (/var/task/node_modules/graphql/execution/execute.js:467:18)",
" at resolveField (/var/task/node_modules/graphql/execution/execute.js:434:16)",
" at executeFields (/var/task/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/var/task/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/var/task/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:591:12)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:557:21)"
]
}
}
}
],
"data": {
"me": {
"basket": null
}
}
}
But when I add another field into the query:
query {
me {
basket {
id
}
customer {
id
}
}
}
I receive multiple errors with merged messages, the code changed to INTERNAL_SERVER_ERROR
and the original errors with codes moved under exception.errors:
{
"errors": [
{
"message": "The request has not been Authenticated\nThe request has not been Authenticated",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"me",
"basket"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"errors": [
{
"message": "The request has not been Authenticated",
"extensions": {
"code": "UNAUTHENTICATED"
}
},
{
"message": "The request has not been Authenticated",
"extensions": {
"code": "UNAUTHENTICATED"
}
}
],
"stacktrace": [
"Error: The request has not been Authenticated",
"The request has not been Authenticated",
" at new CombinedError (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:93:28)",
" at Object.combineErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:104:16)",
" at Object.handleErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/checkResultAndHandleErrors.js:118:44)",
" at defaultMergedResolver (/var/task/node_modules/graphql-tools-fork/dist/stitching/defaultMergedResolver.js:23:63)",
" at resolveFieldValueOrError (/var/task/node_modules/graphql/execution/execute.js:467:18)",
" at resolveField (/var/task/node_modules/graphql/execution/execute.js:434:16)",
" at executeFields (/var/task/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/var/task/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/var/task/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:591:12)"
]
}
}
},
{
"message": "The request has not been Authenticated\nThe request has not been Authenticated",
"locations": [
{
"line": 6,
"column": 5
}
],
"path": [
"me",
"customer"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"errors": [
{
"message": "The request has not been Authenticated",
"extensions": {
"code": "UNAUTHENTICATED"
}
},
{
"message": "The request has not been Authenticated",
"extensions": {
"code": "UNAUTHENTICATED"
}
}
],
"stacktrace": [
"Error: The request has not been Authenticated",
"The request has not been Authenticated",
" at new CombinedError (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:93:28)",
" at Object.combineErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:104:16)",
" at Object.handleErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/checkResultAndHandleErrors.js:118:44)",
" at defaultMergedResolver (/var/task/node_modules/graphql-tools-fork/dist/stitching/defaultMergedResolver.js:23:63)",
" at resolveFieldValueOrError (/var/task/node_modules/graphql/execution/execute.js:467:18)",
" at resolveField (/var/task/node_modules/graphql/execution/execute.js:434:16)",
" at executeFields (/var/task/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/var/task/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/var/task/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:591:12)"
]
}
}
}
],
"data": {
"me": {
"basket": null,
"customer": null
}
}
}
Instead of this, I would expect to receive something like:
{
"errors": [
{
"message": "The request has not been Authenticated",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"me",
"basket"
],
"extensions": {
"code": "UNAUTHENTICATED",
"exception": {
"message": "The request has not been Authenticated",
"stacktrace": [
"Error: The request has not been Authenticated",
"The request has not been Authenticated",
" at new CombinedError (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:93:28)",
" at Object.combineErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:104:16)",
" at Object.handleErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/checkResultAndHandleErrors.js:118:44)",
" at defaultMergedResolver (/var/task/node_modules/graphql-tools-fork/dist/stitching/defaultMergedResolver.js:23:63)",
" at resolveFieldValueOrError (/var/task/node_modules/graphql/execution/execute.js:467:18)",
" at resolveField (/var/task/node_modules/graphql/execution/execute.js:434:16)",
" at executeFields (/var/task/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/var/task/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/var/task/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:591:12)"
]
}
}
},
{
"message": "The request has not been Authenticated",
"locations": [
{
"line": 6,
"column": 5
}
],
"path": [
"me",
"customer"
],
"extensions": {
"code": "UNAUTHENTICATED",
"exception": {
"message": "The request has not been Authenticated",
"stacktrace": [
"Error: The request has not been Authenticated",
"The request has not been Authenticated",
" at new CombinedError (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:93:28)",
" at Object.combineErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/errors.js:104:16)",
" at Object.handleErrors (/var/task/node_modules/graphql-tools-fork/dist/stitching/checkResultAndHandleErrors.js:118:44)",
" at defaultMergedResolver (/var/task/node_modules/graphql-tools-fork/dist/stitching/defaultMergedResolver.js:23:63)",
" at resolveFieldValueOrError (/var/task/node_modules/graphql/execution/execute.js:467:18)",
" at resolveField (/var/task/node_modules/graphql/execution/execute.js:434:16)",
" at executeFields (/var/task/node_modules/graphql/execution/execute.js:275:18)",
" at collectAndExecuteSubfields (/var/task/node_modules/graphql/execution/execute.js:713:10)",
" at completeObjectValue (/var/task/node_modules/graphql/execution/execute.js:703:10)",
" at completeValue (/var/task/node_modules/graphql/execution/execute.js:591:12)"
]
}
}
}
],
"data": {
"me": {
"basket": null,
"customer": null
}
}
}