title: How can I call a graphql lambda from another lambda in nodejs?
body: <p>I created graphql lambda by following this instruction: <a href="https://www.apollographql.com/docs/apollo-server/deployment/lambda/" rel="nofollow noreferrer">https://www.apollographql.com/docs/apollo-server/deployment/lambda/</a>
  It works fine with API gateway. However, I need to call this lambda function from another lambda. I think I need to put <code>ApolloClient</code> in the other lambda function in order to send a graphql request. However, it doesn't work because I can't choose a right link for calling lambda. 
  So I am looking for how to build the graphql request programatically. I can send the request as an event to trigger the graphql lambda. </p>
  
  <p>Is there a way to do that?</p>
  
  <p>For example, if I have a mutation request like:</p>
  
  <pre><code> mutation sendMessage {
        sendMessage(text: "hello"){
        text
      }
  </code></pre>
  
  <p>I need to find a way to convert the request to below payload:</p>
  
  <pre><code>{"id":"1","type":"start","payload":{"variables":{},"extensions":{},"operationName":"sendMessage","query":"mutation sendMessage {\\n  sendMessage(text: \\"hello\\") {\\n    text\\n    __typename\\n  }\\n}\\n"}}
  </code></pre>
  
  <p>then I send this payload to the graphql lambda function</p>