I am using Apollo Client to make an application to query my server using Graphql. I have a python server on which I execute my graphql queries which fetches data from the database and then returns it back to the client.
I have created a custom NetworkInterface for the client that helps me to make make customized server request (by default ApolloClient makes a POST call to the URL we specify). The network interface only has to have a query() method wherein we return the promise for the result of form Promise<ExecutionResult>
.
I am able to make the server call and fetch the requested data but still getting the following error.
Error: Network error: Error writing result to store for query { query something{ row{ data } } } Cannot read property 'row' of undefined at new ApolloError (ApolloError.js:32) at ObservableQuery.currentResult (ObservableQuery.js:76) at GraphQL.dataForChild (react-apollo.browser.umd.js:410) at GraphQL.render (react-apollo.browser.umd.js:448) at ReactCompositeComponent.js:796 at measureLifeCyclePerf (ReactCompositeComponent.js:75) at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:795) at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:822) at ReactCompositeComponentWrapper._updateRenderedComponent (ReactCompositeComponent.js:746) at ReactCompositeComponentWrapper._performComponentUpdate (ReactCompositeComponent.js:724) at ReactCompositeComponentWrapper.updateComponent (ReactCompositeComponent.js:645) at ReactCompositeComponentWrapper.performUpdateIfNecessary (ReactCompositeComponent.js:561) at Object.performUpdateIfNecessary (ReactReconciler.js:157) at runBatchedUpdates (ReactUpdates.js:150) at ReactReconcileTransaction.perform (Transaction.js:140) at ReactUpdatesFlushTransaction.perform (Transaction.js:140) at ReactUpdatesFlushTransaction.perform (ReactUpdates.js:89) at Object.flushBatchedUpdates (ReactUpdates.js:172) at ReactDefaultBatchingStrategyTransaction.closeAll (Transaction.js:206) at ReactDefaultBatchingStrategyTransaction.perform (Transaction.js:153) at Object.batchedUpdates (ReactDefaultBatchingStrategy.js:62) at Object.enqueueUpdate (ReactUpdates.js:200)
I want to know the possible cause of the error and solution if possible.
Advertisement
Answer
I had a similar error. I worked it out by adding id to query. for example, my current query was
query { service:me { productServices { id title } } }
my new query was
query { service:me { id // <------- productServices { id title } } }