question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Diaflow can not connect with firebase

See original GitHub issue

I 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 !! image image image image image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
nathanjliucommented, Feb 27, 2019

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.

1reaction
holdinvestors-doncommented, May 31, 2020

It seems you may be confusing the Actions on Google client library with the Dialogflow-Fulfillment library, i.e. the latter being the place where you are posting your issue. However, you are building an Action and using the Actions on Google client library. I’d check out the available samples. The issue is with your package.json file because you are using the Dialogflow-Fulfillment’s boilerplate dependencies package file, instead it should be:

{
  "name": "your-action-app",
  "description": "This is your Action's webhook",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "8"
  },
  "scripts": {
    "lint": "eslint --fix \"**/*.js\"",
    "start": "firebase serve --only functions",
    "deploy": "firebase deploy --only functions",
    "test": "npm run lint"
  },
  "dependencies": {
    "actions-on-google": "^2.0.0",
    "firebase-admin": "^5.11.0",
    "firebase-functions": "^1.0.0"
  },
  "devDependencies": {
    "eslint": "^4.19.0",
    "eslint-config-google": "^0.9.1"
  }
}

Ok i fixed it. That’s great. Many thanks for your help !!

Sorry, Can you tell more details? I followed the lines, it did not work. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Database not being implemented due to session error
I'm building a chat bot which I have integrated with Dialogflow and Firebase. How can I fix session error ...
Read more >
Troubleshooting & FAQ for Android and Firebase
This page offers tips and troubleshooting for Android-specific issues that ... When I add Firebase to my Android project, I get a "Could...
Read more >
Getting started with Firebase | Firestore - Google Cloud
Log in to the Firebase console, then click Add project. Select your existing Google Cloud project from the dropdown menu, then click Continue....
Read more >
Troubleshoot common Firebase linking errors - Google Support
Can't link to Firebase. · Unable to link app to Firebase. · You have reached the limit of projects in Firebase · Failed...
Read more >
Incidents - Firebase Status Dashboard
If you are experiencing an issue not listed here, please contact Support. ... There was a problem affecting the tester web app, causing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found