title: TypeError: lambda.invoke is not a function
body: <p>I am trying to call an aws lambda function within another lambda function. I tried a very simple code snippet. However, every time I am receiving "TypeError: lambda.invoke is not a function".</p>
  
  <p>Here is my code:</p>
  
  <pre><code>exports.handler = function(event, context) {
      var AWS = require('aws-sdk');
      AWS.config.apiVersions = {
        lambda: '2015-03-31',
        // other service API versions
      };
  
      var lambda = new AWS.Lambda();
  
      var params = {
          FunctionName: "node-sendsms", 
          InvocationType: "Event", 
          LogType: "Tail", 
          Payload: null
      };
  
      lambda.invoke(params, function(err, data) {
          if (err) console.log(err, err.stack); // an error occurred
          else     console.log(data);           // successful response
      });
  };
  </code></pre>
  
  <p>I referred to the documentation here for invoke function: <a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html#invoke-property" rel="nofollow noreferrer">http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html#invoke-property</a>
  and followed same code. I tried changing api version but that did not help. I also tried looking out for any solution online as well as on SO; at least information I got is that it can be an issue of variable scoping for AWS variable. But, as it can be seen in code - it does not seems like that.</p>
  
  <p>Any experts on this error? I am working on node.js 6.10. Here is error detail:</p>
  
  <pre><code>Response:
  {
    "errorMessage": "RequestId: 849581c1-d669-11e7-ad15-6f5e52f0e184 Process exited before completing request"
  }
  
  Request ID:
  "849581c1-d669-11e7-ad15-6f5e52f0e184"
  
  Function Logs:
  START RequestId: 849581c1-d669-11e7-ad15-6f5e52f0e184 Version: $LATEST
  2017-12-01T07:30:35.785Z    849581c1-d669-11e7-ad15-6f5e52f0e184    TypeError: lambda.invoke is not a function
      at exports.handler (/var/task/index.js:22:9)
  END RequestId: 849581c1-d669-11e7-ad15-6f5e52f0e184
  REPORT RequestId: 849581c1-d669-11e7-ad15-6f5e52f0e184  Duration: 1385.62 ms    Billed Duration: 1400 ms    Memory Size: 128 MB Max Memory Used: 24 MB  
  RequestId: 849581c1-d669-11e7-ad15-6f5e52f0e184 Process exited before completing request
  </code></pre>