我正在执行连接到mysql服务器的firebase函数,但是在执行部署时会在此过程中返回错误。
我的功能
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)
});