const AWSXRay = require ( 'aws-xray-sdk' ) ; AWSXRay . captureHTTPsGlobal ( require ( 'http' ) ) ; import { APIGatewayEvent , Callback , Context , Handler } from 'aws-lambda' ; import { sendMail } from './mailSender' ; export const sendEmail = ( event , context , callback ? ) => { return sendMail ( event . body ) . then ( ( { response , error } ) => { if ( error ) { callback && callback ( error ) ; } else { callback && callback ( null , response ) ; } } ) ; } ;