错误的Firebase函数承诺/总是在部署中返回

时间:2019-05-18 15:04:49

标签: javascript firebase google-cloud-functions firebase-tools

我正在执行连接到mysql服务器的firebase函数,但是在执行部署时会在此过程中返回错误。

error returned

我的功能

exports.helloWorld = functions.https.onRequest(async (request, response) => {
//response.send("Hello from Firebase!");
var res = {};
const result = await  mysqlssh.connect(
    {
        host: 'xxxxxxxx',
        user: 'xxxxxxx',
        password: 'xxxxxx',
        port: 'xxxxxx'

    },
    {
        host: '127.0.0.1',
        user: 'xxxxxxx',
        password: 'xxxxx',
        database: 'xxxxxxx',
        port:'3306'
    }
).then(client => {
        client.query('SELECT * FROM `dt_dashboard_user`', (error, results, fields) => {
           // if (err) throw err
            console.log(results);
            mysqlssh.close()
            return results;
        })
    })
    .catch(error => {
        console.log(error)
        return error
    })
    response.send(result)

});

0 个答案:

没有答案