如何解决Firebase 函数和 twilio
我想在实时数据库中创建数据时使用 twilio 发送短信
我创建了以下代码
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const accountSid = "id";
const authToken = "code";
const client = require('twilio')(accountSid,authToken);
exports.sendSMSNotfication = functions.database.ref('issue/{id}').onCreate(evt =>{
client.messages
.create({
body: 'This is the ship that made the Kessel Run in fourteen parsecs?',from: '+1sender',to: '+reciever'
})
.then(message => console.log(message.sid));
});
但是当我部署它时会弹出以下错误
Functions deploy had errors with the following functions:
sendSMSNotfication(us-central1)
To try redeploying those functions,run:
firebase deploy --only "functions:sendSMSNotfication"
To continue deploying other features (such as database),run:
firebase deploy --except functions
Error: Functions did not deploy properly.
短信发送代码是正确的,因为我尝试使用普通终端命令发送它并且它有效
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。