i am trying to invoke an aws lamda function based on an email trigger. i get the email trigger in and it hits the if statement i expect but then it fails to do the lambda.invoke.
what am i missing? i get to most of the log statements but do not seem
exports.handler = function(event, context) {
    var aws = require('aws-sdk');
    var lambda = new aws.Lambda({
        region: 'us-east-1'
    });
    var sesNotification = event.Records[0].ses;
    //console.log("SES Notification:\n", JSON.stringify(sesNotification, null, 2));
    var sub=sesNotification.mail.commonHeaders.subject;
        if(sub){
            if(sub.toLowerCase()=="startpipeline"){
                console.log("Starting Pipeline");
                lambda.invoke({
                              FunctionName: 'StartDevOpsServers',
                              Payload: JSON.stringify(event, null, 2), // pass params
                              InvocationType: 'Event' 
                            }, function(error, data) {
                              if (error) {
                                console.log("error",error,data);
                                context.done('error', error);
                              }
                              if(data.Payload){
                               console.log("succeed",data.Payload);
                               context.succeed(data.Payload)
                              }
                            });
            }else if(sub.toLowerCase()=="stoppipeline"){
                console.log("Stopping Pipeline");
                                lambda.invoke({
                              FunctionName: 'StopDevOpsServers',
                              Payload: JSON.stringify(event, null, 2) // pass params
                            }, function(error, data) {
                              if (error) {
                                context.done('error', error);
                              }
                              if(data.Payload){
                               context.succeed(data.Payload)
                              }
                            });
                    context.succeed();   
            }else{
                console.log('subjectnotRecognized')
            }
        }else{
            console.log("noSubJect")
        }
};
 
     
     
    