Typescript Firebase云函数-缺少Firebase_配置环境变量
我已经初始化了一个新的内部Typescript Firebase云函数-缺少Firebase_配置环境变量,typescript,firebase,google-cloud-functions,nestjs,Typescript,Firebase,Google Cloud Functions,Nestjs,我已经初始化了一个新的内部/functions项目。完成后,我安装了: npm install firebase-admin firebase-functions 之后,我不得不将应用程序链接到云功能,如: const bootstrap = async (expressInstance: Express) => { const app = await NestFactory.create(AppModule, expressInstance); await app.listen
/functions
项目。完成后,我安装了:
npm install firebase-admin firebase-functions
之后,我不得不将应用程序链接到云功能,如:
const bootstrap = async (expressInstance: Express) => {
const app = await NestFactory.create(AppModule, expressInstance);
await app.listen(3000); // Just for easy way to develop
await app.init();
};
bootstrap(server);
exports.api = functions.https.onRequest(server);
在应用程序中,我必须使用firebase admin
来授权用户。这就是问题所在。我假设运行firebase-service--only=function
,它将设置firebase\u-CONFIG,而运行nodemon
,它不会设置firebase\u-CONFIG
我想知道,如何设置此变量及其包含的内容,以便知道如何正确设置。您必须使用配置初始化
firebase admin
。当您使用环境变量调用admin.initializeApp(config)
时,它可以是显式的,也可以是隐式的
有关更多信息,请参阅本指南: