title: Issue on Calling AWS JAVA LAMBDA From Another Java Lambda
body: <p>I want to call a aws lambda which is in JAVA from another lambda. I go through the below result
  <a href="https://stackoverflow.com/questions/36483042/how-to-call-an-aws-java-lambda-function-from-another-aws-java-lambda-function-wh">"https://stackoverflow.com/questions/36483042/how-to-call-an-aws-java-lambda-function-from-another-aws-java-lambda-function-wh"</a></p>
  
  <p>I implemented the code like below. </p>
  
  <p>First I create one AWS lambda java project. My code is like below</p>
  
  <pre><code>import com.amazonaws.services.lambda.AWSLambdaAsyncClientBuilder;
  import com.amazonaws.services.lambda.invoke.LambdaInvokerFactory;
  import com.amazonaws.services.lambda.runtime.Context;
  import com.amazonaws.services.lambda.runtime.RequestHandler;
  
  public class LambdaFunctionHandler implements RequestHandler&lt;Object, String&gt; {
  
      @Override
      public String handleRequest(Object input, Context context) {
          context.getLogger().log("Input: " + input);
  
          FineGrainedService fg = LambdaInvokerFactory.builder()
                  .lambdaClient(
                          AWSLambdaAsyncClientBuilder.standard()
  
                          .build()
                  )
                  .build(FineGrainedService.class);
  
          context.getLogger().log("Response back from FG" + fg.getClass());
  
          String fgRespone = fg.callFineGrained("Call from Gateway");
          context.getLogger().log("fgRespone: " + fgRespone);
  
          // TODO: implement your handler
          return "Hello from Gateway Lambda!";
      }
  }
  </code></pre>
  
  <p>As per the above link created one interface</p>
  
  <pre><code>import com.amazonaws.services.lambda.invoke.LambdaFunction;
  
  public interface FineGrainedService {
       @LambdaFunction(functionName="SimpleFineGrained")
       String callFineGrained(String input);
  }
  </code></pre>
  
  <p>Again created another lambda to call the above lambda</p>
  
  <pre><code>import com.amazonaws.services.lambda.AWSLambdaAsyncClientBuilder;
  import com.amazonaws.services.lambda.invoke.LambdaInvokerFactory;
  import com.amazonaws.services.lambda.runtime.Context;
  import com.amazonaws.services.lambda.runtime.RequestHandler;
  
  public class LambdaFunctionHandler2 implements RequestHandler&lt;Object, String&gt; {
  
      @Override
      public String handleRequest(Object input, Context context) {
          context.getLogger().log("Input: " + input);
  
          FineGrainedService fg = LambdaInvokerFactory.builder()
                  .lambdaClient(
                          AWSLambdaAsyncClientBuilder.standard().build()
                  )
                  .build(FineGrainedService.class);
  
          context.getLogger().log("Response back from FG" + fg.getClass());
  
          String fgRespone = fg.callFineGrained("Call from Gateway");
          context.getLogger().log("fgRespone: " + fgRespone);
  
          // TODO: implement your handler
          return "Hello from Gateway Lambda!";
      }
  }
  </code></pre>
  
  <p>Added maven dependency to pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
      &lt;artifactId&gt;aws-java-sdk-lambda&lt;/artifactId&gt;
   &lt;/dependency&gt;
  </code></pre>
  
  <p>Added lambda invoke permission to my current role.
  Then I uploaded the code to the AWS. But when I am testing this I am getting an error like below.. Please could you help me to figure out this?</p>
  
  <p><a href="https://i.stack.imgur.com/4RHTK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4RHTK.png" alt="enter image description here"></a></p>
  
  <p>It would be grateful if anyone can help to get this... Or any other way to call a lambda from another lambda using JAVA</p>