Vis*_*rma 5 javascript firebase firebase-realtime-database google-cloud-functions
我一直在尝试使用Cloud Functions for Firebase向Firebase中的用户发送电子邮件.我指的是https://github.com/firebase/functions-samples/tree/master/quickstarts/email-users的firebase功能存储库
我根据需要安装了firebase电子邮件功能的所有节点包,并在存储库中进行了解释.我在函数as的index.js文件中编辑了TODO
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
firebase functions:config:set gmail.email="email@gmail.com" gmail.password="gmailPassword"
const gmailEmail = encodeURIComponent(functions.config().gmail.email);
const gmailPassword = encodeURIComponent(functions.config().gmail.password);
const mailTransport = nodemailer.createTransport(
`smtps://${gmailEmail}:${gmailPassword}@smtp.gmail.com`);
Run Code Online (Sandbox Code Playgroud)
当我尝试使用该命令部署该功能时
firebase deploy
Run Code Online (Sandbox Code Playgroud)
解析函数触发器时出错.
有谁可以帮我解决这个问题.
该functions:config
命令是您通过Firebase CLI从命令提示符运行的命令,而不是从 Functions 代码运行的命令。
所以在你的命令提示符/终端中:
firebase functions:config:set gmail.email="email@gmail.com" gmail.password="gmailPassword"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2823 次 |
最近记录: |