title: Variable '$directions' cannot be non input type '[Step!]!' GraphQL apollo-client
body: <p>I'm a beginner at implementing gql so bare with any basic mistakes that might be the cause of this issue.</p>
  <p>I have a mutation that is fired through a Netlify function towards FaunaDB that is returning the above error (Full error below). Making a query works in conjunction with the error make me believe that the issue lies with the</p>
  <p>I've tried to define the typeDefs option in the apollo-client options and my client.js is currently looking like this after a few rounds of shotgun-debugging</p>
  <pre><code>const { API_URL } = require(&quot;./constants&quot;);
  const fetch = require(&quot;cross-fetch&quot;);
  require(&quot;dotenv&quot;).config();
  
  const typeDefs = gql`
    extend type Ingredient {
      name: String!
      amount: String!
      unit: String!
    }
  
    extend type Step {
      text: String!
      timer: Int!
    }
  `;
  
  const cleanTypeName = new ApolloLink((operation, forward) =&gt; {
    if (operation.variables) {
      const omitTypename = (key, value) =&gt; (key === &quot;__typename&quot; ? undefined : value);
      operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
    }
    return forward(operation).map((data) =&gt; {
      return data;
    });
  });
  
  const getClient = ({ method = &quot;POST&quot; } = {}) =&gt; {
    const client = new ApolloClient({
      link: new HttpLink({
        cleanTypeName,
        uri: API_URL,
        fetch,
        headers: {
          Authorization: `Bearer ${process.env.FAUNADB_SERVER_SECRET}`,
        },
        method,
      }),
      cache: new InMemoryCache({ addTypename: false }),
      typeDefs,
    });
    return client;
  };
  module.exports = { getClient };
  
  </code></pre>
  <p>My Netlify function is looking like this</p>
  <pre><code>const { CREATE_RECIPE } = require(&quot;./utils/queries&quot;);
  const { getClient } = require(&quot;./utils/client&quot;);
  exports.handler = async (event, context, callback) =&gt; {
    try {
      const client = getClient({ method: &quot;PUT&quot; });
      let { data } = await client.mutate({
        mutation: CREATE_RECIPE,
        variables: { ...JSON.parse(event.body) },
      });
      const result = data.createRecipe;
      return {
        statusCode: 200,
        body: JSON.stringify(result),
      };
    } catch (error) {
  //return actual error for now
      throw error;
      return {
        statusCode: 500,
        body: JSON.stringify(&quot;Something went wrong while crating the cookbook. Try again later.&quot;),
      };
    }
  };
  </code></pre>
  <p>and lastly the mutation is looking like this</p>
  <pre><code>
  const CREATE_RECIPE = gql`
    mutation CreateRecipe(
      $ownerid: ID!
      $cookbookid: [ID]!
      $name: String!
      $tags: [String]!
      $rating: Int!
      $categories: [String]!
      $images: [String]!
      $directions: [Step!]!
      $ingredients: [Ingredient!]!
    ) {
      createRecipe(
        data: {
          owner: { connect: $ownerid }
          cookbooks: { connect: $cookbookid }
          name: $name
          tags: $tags
          rating: $rating
          categories: $categories
          images: $images
          directions: $directions
          ingredients: $ingredients
        }
      ) {
        name
        owner {
          email
        }
      }
    }
  </code></pre>
  <p>The relevant schema.gql on the Fauna side is looking like this</p>
  <pre><code>  owner: User! @relation
    cookbooks: [Cookbook!]! @relation
    name: String!
    ingredients: [Ingredient!]!
    directions: [Step!]!
    tags: [String]!
    rating: Int!
    categories: [String]!
    images: [String]
  }
  
  type Ingredient @embeded {
    name: String!
    amount: String!
    unit: String!
  }
  
  type Step @embeded {
    text: String!
    timer: Int!
  }
  </code></pre>
  <p>Edit: Full error</p>
  <pre><code>mutation CreateRecipe($ownerid: ID!, $cookbookid: [ID]!, $name: String!, $tags: [String]!, $rating: Int!, $categories: [String]!, $images: [String]!, $directions: [Step!]!, $ingredients: [Ingredient!]!) {
                                                                                                                                                                     ^
  Variable '$ingredients' cannot be non input type '[Ingredient!]!'. (line 1, column 188):
  mutation CreateRecipe($ownerid: ID!, $cookbookid: [ID]!, $name: String!, $tags: [String]!, $rating: Int!, $categories: [String]!, $images: [String]!, $directions: [Step!]!, $ingredients: [Ingredient!]!) {
                                                                                                                                                                                             ^
    ation CreateRecipe($ownerid: ID!, $cookbookid: [ID]!, $name: String!, $tags: [String]!, $rating: Int!, $categories: [String]!, $images: [String]!, $directions: [Step!]!, $ingredients: [Ingredient!]!) {
    
    iable '$ingredients' cannot be non input type '[Ingredient!]!'. (line 1, column 188):
    ation CreateRecipe($ownerid: ID!, $cookbookid: [ID]!, $name: String!, $tags: [String]!, $rating: Int!, $categories: [String]!, $images: [String]!, $directions: [Step!]!, $ingredients: [Ingredient!]!) {
    
    new ApolloError (C:\Users\phili\Documents\Projects\cookbook\node_modules\@apollo\client\errors\errors.cjs.js:31:28)
    Object.next (C:\Users\phili\Documents\Projects\cookbook\node_modules\@apollo\client\core\core.cjs.js:1043:53)
    notifySubscription (C:\Users\phili\Documents\Projects\cookbook\node_modules\zen-observable\lib\Observable.js:135:18)
    onNotify (C:\Users\phili\Documents\Projects\cookbook\node_modules\zen-observable\lib\Observable.js:179:3)
    SubscriptionObserver.next (C:\Users\phili\Documents\Projects\cookbook\node_modules\zen-observable\lib\Observable.js:235:7)
    C:\Users\phili\Documents\Projects\cookbook\node_modules\@apollo\client\utilities\utilities.cjs.js:946:68
    Array.forEach (&lt;anonymous&gt;)
    iterateObserversSafely (C:\Users\phili\Documents\Projects\cookbook\node_modules\@apollo\client\utilities\utilities.cjs.js:946:25)
    Object.next (C:\Users\phili\Documents\Projects\cookbook\node_modules\@apollo\client\utilities\utilities.cjs.js:1020:21)
    notifySubscription (C:\Users\phili\Documents\Projects\cookbook\node_modules\zen-observable\lib\Observable.js:135:18)
  </code></pre>