我正在使用v2对话流。我想从Firebase检索数据,但履行状态显示错误。
use strict;
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
var firestore = admin.firestore();
exports.hotelbooking = functions.https.onRequest((request, response) =>
{
console.log("request.body.queryResult.parameters: ", request.body.queryResult.parameters);
let params = request.body.queryResult.parameters;
firestore.collection('orders').add(params).then( () => { response.send({
speech: this is a response for ${ params.name } });
return true;}).catch((e => { console.log('Error getting documents', e);
response.send({ message:' Sorry, something has gone wrong. Try again and if the problem persists, please report it.' });
return true;
}))
});
我希望输出是index.js的响应