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 (将#修改为@)