jcoder
jcoder

Reputation: 117

Sending SES email from AWS Lambda - Node JS Error "Cannot find module 'nodemailer"

I have this error message: "errorMessage": "Cannot find module 'nodemailer'"

I Googled, and it says install nodemailer. Can someone tell me where exactly do I install this module? I am new to Lambda.

My Lambda function is below :

    var aws = require("aws-sdk");
var nodemailer = require("nodemailer");

var ses = new aws.SES();
var s3 = new aws.S3();

exports.handler = (event, context, callback) => {
callback(null, 'Hello from Lambda');
};

Upvotes: 0

Views: 1530

Answers (1)

  1. You'll have to initialize your project locally npm init
  2. Install nodemailer - npm i nodemailer
  3. You should zip your project directory, upload it to lambda by selecting Upload a .ZIP file in the function code window.
  4. Now you'll get an option to test.
  5. Just put all the code in index.js for your initial tests, later you can move it around.

Upvotes: 2

Related Questions