在显示警告的Firebase函数中,根据GCLOUD_PROJECT估算Firebase配置。初始化firebase-admin可能会失败

时间:2019-10-18 09:37:28

标签: firebase google-cloud-functions

我需要一些帮助来解决这些代码中的问题。我正在尝试创建一个Chatbot库存管理系统。

我的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.6.1",
    "firebase-functions": "^3.3.0",
    "dialogflow": "^0.12.1",
    "dialogflow-fulfillment": "^0.6.1"
  }
}

请告知。

1 个答案:

答案 0 :(得分:0)

直接从firebase控制台获取config变量,并将其传递给您的初始化函数
似乎数据库和google action项目之间的连接不佳。如下图所示。

var config = {  
apiKey: "******",  
authDomain: "*****",  
databaseURL: "****",  
projectId: "****",  
storageBucket: "*****",  
};// your config object could be differ 

const admin = require('firebase-admin');
admin.initializeApp(config);