You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was converting a graph that we used to hit directly over to be a federated service and some of our acceptance tests bombed out with the following error
{
"errors": [
{
"message":"Cannot convert undefined or null to object",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"TypeError: Cannot convert undefined or null to object",
" at hasOwnProperty (<anonymous>)",
" at hasOwnProperty (/app/node_modules/graphql/execution/values.js:219:42)",
" at _loop (/app/node_modules/graphql/execution/values.js:86:10)",
" at coerceVariableValues (/app/node_modules/graphql/execution/values.js:119:16)",
" at Object.getVariableValues (/app/node_modules/graphql/execution/values.js:48:19)",
" at ApolloGateway.validateIncomingRequest (/app/node_modules/@apollo/gateway/dist/index.js:365:37)",
" at ApolloGateway.<anonymous> (/app/node_modules/@apollo/gateway/dist/index.js:75:43)",
" at Generator.next (<anonymous>)",
" at /app/node_modules/@apollo/gateway/dist/index.js:8:71",
" at new Promise (<anonymous>)"
],
},
},
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"TypeError: Cannot convert undefined or null to object",
" at hasOwnProperty (<anonymous>)",
" at hasOwnProperty (/app/node_modules/graphql/execution/values.js:219:42)",
" at _loop (/app/node_modules/graphql/execution/values.js:86:10)",
" at coerceVariableValues (/app/node_modules/graphql/execution/values.js:119:16)",
" at Object.getVariableValues (/app/node_modules/graphql/execution/values.js:48:19)",
" at ApolloGateway.validateIncomingRequest (/app/node_modules/@apollo/gateway/dist/index.js:365:37)",
" at ApolloGateway.<anonymous> (/app/node_modules/@apollo/gateway/dist/index.js:75:43)",
" at Generator.next (<anonymous>)"," at /app/node_modules/@apollo/gateway/dist/index.js:8:71",
" at new Promise (<anonymous>)"
],
},
}
]
}
After some debugging I found that it was because our acceptance test was reusing a query (similar to below)
And in one test it would pass in a storeId and in another test it would not pass in any input variables. When not providing an input variable, the query would error out, but if we provided a variable of type String, null, or undefined, the query would work. It seemed odd that this would error out when going through the federated gateway, but would work when hitting our federated service directly. Is this expected to error out? It seemed like a rather confusing error message if it is expected to not work.
Our federated gateway is running @apollo/federation@0.14.1, @apollo/gateway@0.14.1andapollo-server@2.12.0Our federated service is currently runningapollo-server-hapi@2.8.1`
The text was updated successfully, but these errors were encountered:
abernix
transferred this issue from apollographql/apollo-server
Sep 30, 2020
…ed (#167)
This resolves a "Cannot convert undefined or null to object" error when
the variables provided are undefined but there are nullable variables used
in the Document.
Fixes: #196
Co-authored-by: Jesse Rosenberger <git@jro.cc>
I was converting a graph that we used to hit directly over to be a federated service and some of our acceptance tests bombed out with the following error
After some debugging I found that it was because our acceptance test was reusing a query (similar to below)
And in one test it would pass in a
storeId
and in another test it would not pass in any input variables. When not providing an input variable, the query would error out, but if we provided a variable of type String, null, or undefined, the query would work. It seemed odd that this would error out when going through the federated gateway, but would work when hitting our federated service directly. Is this expected to error out? It seemed like a rather confusing error message if it is expected to not work.Our federated gateway is running
@apollo/federation@0.14.1,
@apollo/gateway@0.14.1and
apollo-server@2.12.0Our federated service is currently running
apollo-server-hapi@2.8.1`The text was updated successfully, but these errors were encountered: