As I was starting to get familiar with AWS and its services (developing a node app in an EC2 instance). I have encountered an interesting hurdle regarding emails.
I set up my domain and email services with "Route53" and "Simple Email Service". Interestingly, when an automated email is sent out with nodemailer, while it works in my local environment it crashes the instance in production - yaaaay! I tried with packages like "aws-sdk", "nodemailer-ses-transport", etc with no luck :)
I have fought out for 2 days and I think it's time to reach out for help :) If you encountered the same issue or have any pointers, please let me know. If you are having the same issues we can cry together :P Thanks!
A couple of thoughts:
There are more. Have you gone through the developer guide?
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/Welcome.html
Yes, all checked :) Thanks for the link, I'll check the extended list :) Really appreciated!
Crashed an instance? You need to check the logs. SES only allows you to send emails to verified users - you can add a few to test with in the SES console. Eventually, you will need to request quota limit to exit their sandbox -- until you do that, you will not be able to send emails to anyone else other than verified users.
I e other thing to watch out for is that SES is not available in every zone, so check where you are for availability.
Thank you so much for your input.
Any pointers? Thanks a lot for your help :) Really appreciated!
EC2 logs wont tell you anything -- these are system logs and you should be separately logging from your app. Winston should help here. I did check what I use for my SES lib and its just aws-sdk lib.
const aws = require('aws-sdk');
const util = require('util');
const router = express.Router();
const logger = require('winston');
aws.config.update({
accessKeyId: '##############',
secretAccessKey: '####################################',
region: 'us-east-1'
});
const ses = new aws.SES({ apiVersion: 'latest' });
Thank you so much! it's really helpful, I'll try your structure and see if I can make it work.
BTW - I also discover that my app logs are under "user/.pm2/logs" I'm using pm2 and didn't know it's storing the logs by itself.
Thanks again!!!!