title: AWS lambda function- 'An error has occurred: Received error response from Lambda: Handled'
body: <p>Working on <code>AWS Lex</code> for creating a ChatBot and using the <code>Node.js</code> in <code>AWS Lambda</code>. </p>
  
  <blockquote>
    <p>Error: An error has occurred: Received error response from Lambda:
    Handled</p>
  </blockquote>
  
  <p>Lambda function:  </p>
  
  <pre><code>var aws = require('aws-sdk');
  var ses = new aws.SES({region: 'us-east-1'});
  
      exports.handler = function(event, context, callback) {
  
          var eParams = {
              Destination: {
                  ToAddresses: [event.currentIntent.slots.Email]
              },
              Message: {
                  Body: {
                      Text: {
                          Data: "Hi, How are you?"
                      }
                  },
                  Subject: {
                      Data: "Title"
                  }
              },
  
              Source: "abc@gmail.com"
          };
          var email = ses.sendEmail(eParams, function(err, data){
              if(err) 
              else {
  
                  context.succeed(event);
  
              }
          });
      };
  </code></pre>
  
  <p>How to get a proper response from Lambda to Lex after successful execution (Email Service works properly). I have tried <code>context.done();</code> but it did not worked out.</p>
  
  <p>Edit 1:
  Tried adding below response test from <a href="http://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html" rel="nofollow noreferrer">AWS Documentation for LEX</a> still getting the same error response.</p>
  
  <pre><code>exports.handler = (event, context, callback) =&gt; { 
  
  callback(null, { 
  "dialogAction": { 
  "type": "ConfirmIntent", 
  "message": { 
  "contentType": "PlainText or SSML", 
  "content": "message to convey to the user, i.e. Are you sure you want a large pizza?" 
  } 
  
  } 
  
  
  });
  </code></pre>