How to disable Firebase Storage emulator?

Viewed 948

When I start the emulators, the Storage emulator starts and is available at localhost:9199.
Then I access storage with the admin SDK in node.js with:

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

Now storage points to the emulator, not the real service as before this emulator has been implemented.
How can I get access to the real service?
I have tried setting projectId and the env variable as described here, but it does not work.

2 Answers

OK, so the way is simply to start all services but storage from the command line, and not from firebase.json, this way:

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

Running firebase emulators:start will start all services in an emulated state. If you want to talk to a production service, you can run firebase serve, or if you want some services emulated but not storage, you can run firebase serve --only {services,to,emulate} (eg, firebase serve --only functions,hosting. This would emulate functions and hosting, but any call to storage (or auth or other non-emulated services) would talk to the live Firebase environment.

Related