我只想从经过验证的域和经过验证的电子邮件地址(仍在沙箱中)发送一封电子邮件以通过 Firebase 函数和 AWS 简单电子邮件服务 (SES) 测试连接。因此,我安装了 node-ses 并创建了以下代码。我将 vuejs 用于 webapp 和 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)
})
})
问题是,我什至无法部署此功能:每次收到相同的错误消息时:
...
+ 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.
但是,如果我部署一个简单的 Firebase 函数,它就可以工作。所以这与我的设置无关。
有人知道我做错了什么吗?
谢谢!!克里斯