I have an issue with Apollo client version 2 with React. (https://www.apollographql.com/docs/react/)
When I setup Apollo client according to docs, I can't make query on GraphQl server, it raises error:
Uncaught (in promise) TypeError: _super.call is not a function
at new ObservableQuery (ObservableQuery.js:36)
at QueryManager.watchQuery (QueryManager.js:393)
at QueryManager.js:420
at new Promise (<anonymous>)
at QueryManager.query (QueryManager.js:418)
at ApolloClient.query (ApolloClient.js:86)
at Object._typeof (index.js:21)
at __webpack_require__ (bootstrap 4164d2c8f7d280e544dd:19)
at Object.<anonymous> (location.js:34)
at __webpack_require__ (bootstrap 4164d2c8f7d280e544dd:19)
My code here:
import { ApolloClient } from "apollo-client";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import gql from "graphql-tag";
const client = new ApolloClient({
link: new HttpLink({ uri: "https://q80vw8qjp.lp.gql.zone/graphql" }),
cache: new InMemoryCache()
});
client
.query({query: gql`{hello}`})
.then(console.log);
Could anyone help me in resolving this issue?
Disclaimer: My response assumes you are having the same problem as me.
Not sure exactly what is going on here, but seems like a problem with webpack on Windows. I'm fortunate enough to be running Parallels (Windows 10) on a MacBook Pro so I was able to overcome this problem by running webpack against my Windows project on the Mac instead of Windows.
Not quite an answer, but a clue, and work around.
If you're not able to build on a Mac though this is not much help in the short term. One more reason to consider switching to Apple if you haven't already ;)
Probs need to log an issue with the webpack team to get the problem fixed https://github.com/webpack/webpack/issues, but this work around will get me by for now, so am going to move on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With