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.

In Firebase Functions showing Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail - error message

See original GitHub issue

I am creating a bot on Dialogflow, and I am using Dialogflow-fulfillment for dynamic response and Firebase Real-time Database as a database.

What i am trying to do is creating a chatbot for inventory management which query a product from the inventory from a mobile app.

Here are some errors that I am getting in “Firebase Logs”: Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail.

const functions = require('firebase-functions'); apiKey: xxxxx, authDomain:xxxxx, databaseURL: xxxxx, projectId: xxxxx, storageBucket:xxxxx, messagingSenderId:xxxxx, ;// your config object could be differ const admin = require('firebase-admin'); admin.initializeApp(config); process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); console.log('Dialogflow Request body: ' + JSON.stringify(request.body));

const db = admin.database();
const action = request.body.queryResult.action;
if (action === 'product_description') {
    const product = request.body.queryResult.parameters.Products.trim();
    const ref = db.ref(`products/${product.toLowerCase()}/description`);
    ref.once('value').then((snapshot) => {
        const result = snapshot.val();
        if (result === null) {
            response.json({
                fulfillmentText: `Product does not exists in inventory`
            });
            return;
        }
        response.json({
            fulfillmentText: `Here is the description of ${product}: ${result}`,
            source: action
        });

    }).catch((err) => {
        response.json({
            fulfillmentText: `I don't know what is it`
        });

    });
} else if(action === 'product_quantity') {
    const product = request.body.queryResult.parameters.Products.trim();
    const ref = db.ref(`products/${product.toLowerCase()}`);
    ref.once('value').then((snapshot) => {
        const result = snapshot.val();
        if (result === null) {
            response.json({
                fulfillmentText: `Product does not exists in inventory`
            });
            return;
        }
        if (!result.stock) {
            response.json({
                fulfillmentText: `Currently ${product} is out of stock`,
                source: action
            });
        } else {
            response.json({
                fulfillmentText: `We have ${result.stock} ${product} in stock`,
                source: action
            });
        }
    }).catch((err) => {
        response.json({
            fulfillmentText: `I don't know what is it`
        });
    });
} else {
    response.json({
        fulfillmentText: `I don't know what is it`
    });
}

});`

Here is the package.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.12.0", "firebase-admin": "^8.8.0", "firebase-functions": "^3.3.0", "dialogflow": "^0.12.1", "dialogflow-fulfillment": "^0.6.1" } }

Please advise.

Thank you.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

1reaction
FarahBedoui96commented, Dec 26, 2019

hello, I tried the same tutorial and I have same warning and always responding either (default response) or “product does not exist in inventory” if u found a solution tell me please

0reactions
sauravotonobots1commented, Jul 29, 2020

any luck?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning, estimating Firebase Config based on ... - GitHub
Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail #853 ... No warnings shown ...
Read more >
dialogflow es - Warning, estimating Firebase Config based on ...
Initializing firebase-admin may fail. I am trying to access an external API from the code. Is this the right way to do it?...
Read more >
Configure your environment | Cloud Functions for Firebase
The Firebase SDK for Cloud Functions offers built-in environment configuration to make it easy to store and retrieve this type of data for...
Read more >
Firebase Function Oncall, Response: Warning ... - ADocLib
Function execution took 10 ms finished with status code: 200 Warning estimating Firebase Config based on GCLOUDPROJECT. Initializing functions.https.
Read more >
firebase-admin - npm
Firebase admin SDK for Node.js. Latest version: 11.4.1, last published: 7 days ago. Start using firebase-admin in your project by running ...
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