Apollo is not assignable to parameter of type ‘VueClass

The syntax for the “apollo” options you listed do indeed look correct- assuming you’re intending to use the package “vue-apollo” to work with Apollo. If you’re getting this error it may mean that “vue-apollo” hasn’t been installed, or there’s some problem with the installation. If you look in the Vue Chrome debugger tool on one … Read more

Stitching secure subscriptions using makeRemoteExecutableSchema

I have one working solution: the idea is to not create one instance of SubscriptionClient for the whole application. Instead, I’m creating the clients for each connection to the proxy server: server.start({ port: 4000, subscriptions: { onConnect: (connectionParams, websocket, context) => { return { subscriptionClients: { messageService: new SubscriptionClient(process.env.MESSAGE_SERVICE_SUBSCRIPTION_URL, { connectionParams, reconnect: true, }, ws) … Read more

How to execute an async fetch request and then retry last failed request?

I’m refreshing the token this way (updated OP’s): import { ApolloClient } from ‘apollo-client’; import { onError } from ‘apollo-link-error’; import { ApolloLink, Observable } from ‘apollo-link’; // add Observable // Define Http link const httpLink = new createHttpLink({ uri: ‘/my-graphql-endpoint’, credentials: ‘include’ }); // Add on error handler for apollo link return new ApolloClient({ … Read more

Using GraphQL Fragment on multiple types

Fragments are only used on the client-side when making requests — they can’t be used inside your schema. GraphQL does not support type inheritance or any other mechanism that would reduce the redundancy of having to write out the same fields for different types. If you’re using apollo-server, the type definitions that make up your … Read more

GraphQL : the object name is defined in resolvers, but not in schema

Couple of things to fix here. First, to use an object as an argument, you have to define it as an input (or GraphQLInputObjectType) in your schema — you cannot use a regular type (or GraphQLObjectType) as an argument. So your type definitions need to look something like this: type Mutation { agreementsPost(agreement: Agreement): String … Read more

How to chain two GraphQL queries in sequence using Apollo Client

The props added by your firstQuery component will be available to the component below (inside) it, so you can do something like: export default compose( graphql(firstQuery, { name: ‘firstQuery’ }), graphql(secondQuery, { name: ‘secondQuery’, skip: ({ firstQuery }) => !firstQuery.data, options: ({firstQuery}) => ({ variables: { var1: firstQuery.data.someQuery.someValue } }) }) )(withRouter(TestPage)) Notice that we … Read more

How to refresh JWT token using Apollo and GraphQL

The example given in the the Apollo Error Link documentation is a good starting point but assumes that the getNewToken() operation is synchronous. In your case, you have to hit your GraphQL endpoint to retrieve a new access token. This is an asynchronous operation and you have to use the fromPromise utility function from the … Read more