I just want to send an email to test the connection via Firebase Functions and AWS Simple Email Service (SES) from a verified domain and verified email addresses (still in sandbox). Therefore I installed node-ses and created the following code. I use vuejs for the webapp and nodejs.
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access Firestore.
const admin = require('firebase-admin');
admin.initializeApp();
// AWS Credentials
var ses = require('node-ses'),
client = ses.createClient({
key: '...',
secret: '...',
amazon: 'https://email-smtp.eu-west-3.amazonaws.com'
});
exports.scheduledFunction = functions.pubsub.schedule('every 10 minutes').onRun((context) => {
// Give SES the details and let it construct the message for you.
client.sendEmail({
to: 'support@myVerfiedDomain.com'
, from: 'do_not_reply@myVerfiedDomain.com'
//, cc: 'theWickedWitch@nerds.net'
//, bcc: ['canAlsoBe@nArray.com', 'forrealz@.org']
, subject: 'Test'
, message: 'Test Message'
, altText: 'Whatever'
}, function (err, data, res) {
console.log(err)
console.log(data)
console.log(res)
})
})
The problem is, I can't even deploy this function: every time I get the same error message:
...
+ functions: created scheduler job firebase-schedule-scheduledFunction-us-central1
+ functions[scheduledFunction(us-central1)]: Successful upsert schedule operation.
Functions deploy had errors with the following functions:
scheduledFunction(us-central1)
To try redeploying those functions, run:
firebase deploy --only "functions:scheduledFunction"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
But if I deploy a simple Firebase Function it works. So it has nothing to do with my setup.
Does anybody know what I do wrong?
Thanks!! Chris