grand-stack-starter
grand-stack-starter copied to clipboard
Graphql variables in nested types
Got error while playing with graphql API in worldcup branch.
Error :
{
"data": {
"worldcups": null
},
"errors": [
{
"message": "Cannot read property 'replace' of undefined",
"locations": [],
"path": [
"worldcups"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"errors": [
{
"message": "Cannot read property 'replace' of undefined",
"locations": [],
"path": [
"worldcups"
]
}
],
"stacktrace": [
"Error: Cannot read property 'replace' of undefined",
" at new CombinedError (/home/nowuser/src/node_modules/graphql-tools/src/stitching/errors.ts:85:5)",
" at Object.checkResultAndHandleErrors (/home/nowuser/src/node_modules/graphql-tools/src/stitching/errors.ts:107:11)",
" at CheckResultAndHandleErrors.transformResult (/home/nowuser/src/node_modules/graphql-tools/src/transforms/CheckResultAndHandleErrors.ts:15:12)",
" at /home/nowuser/src/node_modules/graphql-tools/src/transforms/transforms.ts:37:45",
" at Array.reduce (<anonymous>)",
" at applyResultTransforms (/home/nowuser/src/node_modules/graphql-tools/src/transforms/transforms.ts:35:21)",
" at /home/nowuser/src/node_modules/graphql-tools/src/stitching/delegateToSchema.ts:81:12",
" at step (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:32:23)",
" at Object.next (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:13:53)",
" at fulfilled (/home/nowuser/src/node_modules/graphql-tools/dist/stitching/delegateToSchema.js:4:58)"
]
}
}
}
]
}
while running following query :
query Matches($year: Int!, $round: String) {
worldcups(year: $year) {
name
matches(round: $round) {
round
description
homeScore
awayScore
}
}
}
with variables :
{
"year": 2018,
"round": "Group matches - Group C"
}
Does it work with literals?
Yes, query with literals works.