Sai*_*alu 11 firebase google-cloud-functions
我尝试运行 index.js 文件,它显示以下错误
C:\blog\functions>node index.js
{"severity": "WARNING", "message": "Warning, FIREBASE_CONFIG and GCLOUD_PROJECT environment variables are missing. Initializing firebase-admin will fail"}```
i know that
Run Code Online (Sandbox Code Playgroud)
firebase功能:配置:设置someservice.key =“API密钥”someservice.id =“客户端ID”
this command will set environmental variables but what values should I set in environmental variables
I don't understand these lines from firebase documentation: (https://firebase.google.com/docs/functions/config-env)
process.env.GCLOUD_PROJECT: Provides the Firebase project ID
process.env.FIREBASE_CONFIG: Provides the following Firebase project config info:
should i set firebaseConfig details from project settings into environmental variables
Run Code Online (Sandbox Code Playgroud)
I'm*_*Too 11
FIREBASE_CONFIG和GCLOUD_PROJECT是 Firebase Functions 服务器上的环境变量。未设置它们的原因是因为您尝试在标准节点环境 ( node index.js) 中运行函数代码,而不是在 Firebase 生产服务器上或通过 firebase-tools 包在本地环境中运行它们serve,shell或者emulate在本地运行它们模拟服务器并为您提供正确的配置。
您不必设置这些值 - 只需在 Firebase 模拟器(或 shell)中运行您的函数即可。查看有关如何启动和运行的文档。