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

编程入门 行业动态 更新时间:2024-10-27 08:39:32
本文介绍了解析功能触发器时出现Firebase错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在尝试使用Cloud Functions for Firebase向Firebase中的用户发送电子邮件。我指的是

解析函数触发器时出错。

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

解决方案

functions:config 是您使用 Firebase CLI ,而非函数代码。

所以在命令提示符/ terminal中:

firebase功能:config:set gmail.email =email@gmailgmail.password =gmailPassword

I had been trying to send emails to the users in Firebase using Cloud Functions for Firebase. I am referring to the repository of firebase function at github/firebase/functions-samples/tree/master/quickstarts/email-users

I install all the node packages for the firebase email function as required and explained on the repository. I edited TODO in the index.js file in functions as

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 nodemailer/transports/ // TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables. firebase functions:config:set gmail.email="email@gmail" 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`);

When I try to deploy the function using the command

firebase deploy

It shows me the following error

Error occurred while parsing your function triggers.

Could anyone please help me out in solving this.

解决方案

The functions:config is a command that you run with the Firebase CLI from the command prompt, not from your Functions code.

So in your command prompt/terminal:

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

更多推荐

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

本文发布于:2023-10-19 18:22:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1508369.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:触发器   错误   功能   Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!