title: Aws lambda return promise
body: <p>I am working with aws lamda and creating a function returning a promise from it and then consuming it in my client function in node. Due to some reason it is returning Promise and i am not able to figure out what is wrong here. Here is the following code snippet : -</p>
  
  <p>Lamda Function</p>
  
  <pre><code>function paymentConfirmationMessage() {
      return new Promise((resolve) =&gt; {
          setTimeout(() =&gt; {
              resolve("I came from lamda");
          }, 20000);
      });
  }
  
  exports.handler = async (event) =&gt; {
      let calculationResult = await paymentConfirmationMessage();
      return calculationResult;
  } 
  </code></pre>
  
  <p>In node client : -</p>
  
  <pre><code>const https = require("https");
  const url = "SomeLamdaurl.com/get";
  
  function getData(url) {
      return new Promise(resolve =&gt; {
          https.get(url, function (error, response, body) {
              resolve(body);
          });
      });
  }
   async function test(){
      var body = await getData(url);
      if (body) {
      const obj = JSON.parse(body);
      console.log('obj', obj);
      }
      else {
      }
   }
  test();
  </code></pre>
  
  <p>Additionally when i am making call from api gateway setup in lamda i am getting the desired response. </p>
  
  <p>Any lead will be helpful. Thanks!</p>