Tuesday 23 May 2017

AWS Lex Error- 'An error has occurred: Received error response from Lambda: Handled'

Working on AWS Lex for creating a ChatBot and using the Node.js in AWS Lambda.

Error: An error has occurred: Received error response from Lambda: Handled

Lambda function:

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);

            }
        });
    };

How to get a proper response from Lambda to Lex after successful execution (Email Service works properly). I have tried context.done(); but it did not worked out.



via Sarthak Srivastava

No comments:

Post a Comment