Hi,
I'm usually work with apollo-client in my REACT application.
Now i'm having this error doing a QUERY request from a new project created today.
Versions
System:
OS: macOS 10.14
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 61.0.2
Safari: 12.0
Thanks for your help!!!
+
Hi! I'm having this problem as well. Help would be appreciated! Here's the stack...
2018-11-16T07:50:55.077598287Z (node:16) UnhandledPromiseRejectionWarning: Error: GraphQL error: Invalid AST Node: {}
2018-11-16T07:50:55.077641287Z at new ApolloError (/app/node_modules/src/errors/ApolloError.ts:56:5)
2018-11-16T07:50:55.077647487Z at Object.next (/app/node_modules/src/core/QueryManager.ts:258:21)
2018-11-16T07:50:55.077651887Z at notifySubscription (/app/node_modules/zen-observable/lib/Observable.js:130:18)
2018-11-16T07:50:55.077656287Z at onNotify (/app/node_modules/zen-observable/lib/Observable.js:165:3)
2018-11-16T07:50:55.077660587Z at SubscriptionObserver.next (/app/node_modules/zen-
Hi, I don't know if it will help you but i had this error too and i fixed it even if i don't really why it was creating this error.
in my apollo-client init i'm using apollo-link-state and i had this init :
// apolloClient.ts
[...]
import { withClientState } from 'apollo-link-state'
import { defaults, resolvers, typeDefs } from './resolvers'
[...]
const stateLink = withClientState({
cache,
defaults,
resolvers,
typeDefs,
})
[...]
// resolvers.ts
export const defaults = {
isConnected: true,
}
export const resolvers = {
Mutation: {
updateNetworkStatus: (_, { isConnected }, { cache }) => {
cache.writeData({ data: { isConnected } })
return null
},
},
}
export const typeDefs = {}
to fix the error i simply change my typeDefs :
// from
export const typeDefs = {}
// to
export const typeDefs = ``
After that change, everything worked again. I hope that helps :)
Thanks wcastand, that change fix the error. Thank you so much
I'll close this since it appears to be resolved!
Most helpful comment
Hi, I don't know if it will help you but i had this error too and i fixed it even if i don't really why it was creating this error.
in my apollo-client init i'm using apollo-link-state and i had this init :
to fix the error i simply change my typeDefs :
After that change, everything worked again. I hope that helps :)