如何禁用Firebase存储模拟器



当我启动模拟器时,存储模拟器将启动,并可在localhost:9919上使用
然后我使用node.js中的管理SDK访问存储,其中包含:

serviceAccountKey = require('./serviceAccountKey.json');
const config = {
credential: admin.credential.cert(serviceAccountKey),
};
const adminApp = admin.initializeApp(config);
const storage = adminApp.storage();

现在存储指向模拟器,而不是实现该模拟器之前的真正服务
我如何获得真正的服务
我尝试过设置projectId和env变量,如这里所述,但它不起作用。

好的,所以方法只是从命令行启动所有服务,但存储除外,而不是从firebase.json启动,这种方式:

firebase emulators:start --only hosting,functions,firestore,auth,ui

运行firebase emulators:start将在模拟状态下启动所有服务。如果您想与生产服务对话,可以运行firebase serve。如果您想模拟一些服务,但不想模拟存储,则可以运行firebase serve --only {services,to,emulate}(例如firebase serve --only functions,hosting(。这将模拟功能和主机,但对存储的任何调用(或身份验证或其他非模拟服务(都将与实时Firebase环境对话。

最新更新