I am working on a chatbot project using Google Dialogflow on node.js and would like to use Amazon SES but for some reason it is failing and the code I am using is as below:
var aws = require('aws-sdk');
var ses = new aws.SES(
{
"accessKeyId": functions.config().aws.key,
"secretAccessKey": functions.config().aws.secret,
"region": "eu-west-1" ,
});
var eParams = {
Destination: {
ToAddresses: ["x@y.com"]
},
Message: {
Body: {
Text: {
Data: "Hey! What is up?"
}
},
Subject: {
Data: "Email Subject!!!"
}
},
Source: "x.y@z.com"
};
var email = ses.sendEmail(eParams, function(err, data){
if(err) console.log(err);
else {
console.log("===EMAIL SENT===");
console.log(data);
}
});
The error I am getting when I look into the logs in Firebase Functions is:
dialogflowFirebaseFulfillment
{ UnknownEndpoint: Inaccessible host: email.us-standard.amazonaws.com'. This service may not be available in the
eu-west-1` region.
at Request.ENOTFOUND_ERROR (/user_code/node_modules/aws-sdk/lib/event_listeners.js:456:46)
A am using the free tier of Firebase, is this something that matters?