title: AWS Lambda Invoke Function not return, calling invoked function in loop
body: <p>I have one <strong>AWS Lambda Function</strong> as "<code>Get-All-Project-Sessions</code>" with API Getaway. And returning response if I try from API Rest client.</p>
  
  <ol>
  <li>I created one new AWS Lambda function- "<code>Dev-Test-Lambda-Invoke</code>", </li>
  <li>From which I am invoking "Get-All-Project-Sessions".</li>
  </ol>
  
  <p>Code:</p>
  
  <pre><code>import boto3
  import json
  
  
  def get_all_projects_session():
      print("In function...")
      client = boto3.client('lambda')
      res = client.invoke(
          FunctionName='cbr-all-projects-sessions',
          InvocationType='RequestResponse',
          Payload=json.dumps({'httpMethod': 'GET'})
      )
      print(res)
      print("HTTPStatusCode: {}".format(res["ResponseMetadata"]["HTTPStatusCode"]))
      print(res['Payload'])
      response_pauload = res['Payload'].read()
      return response_pauload
  
  def lambda_handler(event, context):
      try:
          print("In Lambda Handler")
          response = get_all_projects_session()
          print(response)
          return response
      except Exception as err:
          print("Exception1: {}".format(err))
          return("Exception: {}".format(err))
  
      return 'Hello from Lambda'
  </code></pre>
  
  <p>After running code, I am getting Time Out as response because Lambda function timeout after <code>300 sec</code> i.e. <code>5 minutes</code>.</p>
  
  <p>I checked Cloud Watch Log for "<code>Dev-Test-Lambda-Invoke</code>" Lambda function which show only two statements which I printed in code which are <code>"In Lambda Handler" and "In function..."</code></p>
  
  <p>I checked Cloud Watch Log for "Get-All-Project-Sessions" Lambda function which running in infinity loop after code then its start again. But when I call API from RESTClient then "Get-All-Project-Sessions" return correct response.</p>
  
  <p>Any Idea?? </p>