Я хочу использовать Firestore в моем боте DialogFlow, но он показывает определенные ошибки. Это мой индекс. js код:
function writeToDb () {
console.log(`Inside writeToDb`);
// Get parameter from Dialogflow with the string to add to the database
const databaseEntry = {
'eMail':'shashank@gmail.com'
};
console.log(databaseEntry);
// Get the database collection 'dialogflow' and document 'agent' and store
// the document {entry: "<value of database entry>"} in the 'agent' document
const dialogflowAgentRef = db.collection('dialogflow').doc('agent');
return db.runTransaction(t => {
t.set(dialogflowAgentRef, {entry: databaseEntry});
return Promise.resolve('Write complete');
}).then(doc => {
agent.add(`Wrote "${databaseEntry}" to the Firestore database.`);
}).catch(err => {
console.log(`Error writing to Firestore: ${err}`);
agent.add(`Failed to write "${databaseEntry}" to the Firestore database.`);
});
}
Это мой пакет. json:
{
"name": "dialogflowFirebaseFulfillment",
"description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "8"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.5.0",
"i18n" : "^0.8.4",
"@google-cloud/firestore": "^0.16.1",
"firebase-admin": "^6.0.0"
}
}
И вот ошибки, которые я получаю:
Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail
Billing account not configured. External network is not accessible and quotas are severely limited.
Configure billing account to remove these restrictions
Я уже собрал коллекцию 'dialogflow' и документ 'agent' в моем пожарном депо.