繁体   English   中英

解析功能触发器时出现Firebase错误

[英]Cloud Functions for Firebase Error occurred while parsing your function triggers

我一直在尝试使用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`);

当我尝试使用该命令部署该功能时

firebase deploy

它向我显示以下错误 在此输入图像描述

解析函数触发器时出错。

有谁可以帮我解决这个问题。

functions:config是一个命令,您可以从命令提示符处使用Firebase CLI运行,而不是从函数代码运行。

所以在你的命令提示符/终端:

firebase functions:config:set gmail.email="email@gmail.com" gmail.password="gmailPassword"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM