GraphQL mutation: Invariant Violation: Must contain a query definition

There is currently a GitHub issue that speaks of this error: https://github.com/apollographql/apollo-client/issues/1539


You should use the mutate method of the client for mutations, not the query method. The options for the method can be found in the docs. Apollo is opinionated about how queries and mutations are treated, so each method has different options that are appropriate to each operation's behavior (for example, mutate includes a refetchQueries option).

client.mutate({
  mutation: gql`
    mutation {
      addTeam(input:{name:"Somename", label:"somelabel"}) {
        error
        status
      }
    }`,
})