Apollo-client: Local mutation resolver not working

Created on 8 Oct 2019  路  3Comments  路  Source: apollographql/apollo-client

Intended outcome:
I'm trying to use local mutation resolver

Actual outcome:
The resolvers function never gets called and I noticed that there is a warning message too.

Found @client directives in a query but no ApolloClient resolvers were specified. This means ApolloClient local resolver handling has been disabled, and @client directives will be passed through to your link chain.

How to reproduce the issue:

  • Create an Apollo client
const client = new ApolloClient({
  cache,
  typeDefs,
  resolvers: {
    Mutation: {
      changeLanguage: (root, args) => {
        console.log('called')
        // do stuff
      }
    }
  },
});
  • Call the mutation following
const mutation = gql`
   mutation changeLanguage($language: String!) {
     changeLanguage(language: $language) @client
  }
`
const variables = {
  language: 'en'
}

Versions

System:
    OS: macOS Mojave 10.14.6
  Binaries:
    Node: 12.7.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.10.2 - /usr/local/bin/npm
  Browsers:
    Chrome: 77.0.3865.90
    Safari: 13.0.1
  npmPackages:
    apollo-angular: ^1.7.0 => 1.7.0 
    apollo-client: ^2.6.4 => 2.6.4

Most helpful comment

Same problem here :cry:

All 3 comments

We also encountered this issue with an identical setup for resolvers and invocation using apollo-client 2.6.4

Same problem here :cry:

Same here, did someone manage to solve the problem, please?

Was this page helpful?
0 / 5 - 0 ratings