[Bug] Diaflow can not connect with firebase
See original GitHub issueI have a fulfillment inline editor code
'use strict';
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const {
dialogflow,
BasicCard,
BrowseCarousel,
BrowseCarouselItem,
Button,
Carousel,
Image,
LinkOutSuggestion,
List,
MediaObject,
Suggestions,
SimpleResponse,
Table } = require('actions-on-google');
const intentSuggestions = [
'Control',
'Get Status',
'light on',
'light off',
'light status',
'fan on',
'fan off',
'fan status',
];
const app = dialogflow();
app.intent('Input_Welcome', (conv) => {
conv.ask(`Welcome, How can I help?`);
conv.ask(new Suggestions(intentSuggestions));
});
app.intent('device',(conv, { devices, status }) => {
return admin.database().ref(`/ESP8266/${devices}/value`).set(status)
.then(snapshot => {
conv.ask(`OK, switching ${devices} ${status}. Do you want more?`);
conv.ask(new Suggestions(intentSuggestions));
})
.catch(error => console.error(error)); // Added a catch block
});
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
When i deploy it, i have an error in function logs “dialogflowFirebaseFulfillment Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail “(1) . When i call “light on” in simulator to trigger “device” intent , i have an error " xxx left the conservation” and function logs " FIREBASE FATAL ERROR: Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com …”(2) . If I remove this code
return admin.database().ref().set()
.then(snapshot => {
});
the simulator is ok ( but still have the error (1)). About three months ago, I deployed this code and it all okay. I read the changelogs and docs but cant find how to fix it. Pls help me what wrong with firebase. I use realtime database.
This is my pakage.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-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.5.0"
}
}
I contacted with firebase support and he recommend me open a bug. Sorry for my bad english !!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
To make calls to external network requests you need to be on the Flame or Blaze plans of Firebase. You are on the free Spark plan. This may or may not be a cause of your issue.