I’m using Firebase emulators to develop and test Cloud Functions locally, and one of my use cases involves uploading a file to Cloud Storage. As part of this process, I initialize Firebase emulators with the Cloud Storage service as follows:
npx firebase init emulators
=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. Storage
Emulator
? Which port do you want to use for the storage emulator? 9199
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)?
? Would you like to download the emulators now? Yes
Then I tried starting firebase emulators for cloud storage, but got an error:
npx firebase emulators:start --only storage
Error: Cannot start the Storage emulator without rules file specified in firebase.json: run 'firebase init' and set up your Storage configuration
This makes sense because the storage.rules file needs to be created before the emulators can start up Cloud Storage. So, next I ran:
npx firebase init storage
=== Storage Setup
Error: Cloud resource location is not set for this project but the operation you are attempting to perform in Cloud Storage requires it. Please see this documentation for more details: https://firebase.google.com/docs/projects/locations
I went to the Firebase Console, enabled storage, and selected the service location, matching the location of all other Firebase services I’m using. However, even after a few hours, I keep receiving the same error message, as if my local Firebase setup doesn’t recognize that the storage service has been activated.
Environment Details:
• macOS Sequoia 15.0
• VS Code 1.95.1
• Node.js v18 (also tried with v20 and v22)
• Firebase CLI 13.23.1
A fix was released in firebase-tools v13.24.1. See https://github.com/firebase/firebase-tools/releases/tag/v13.24.1 and https://github.com/firebase/firebase-tools/pull/7905. Upgrading to the latest version(or at least v13.4.1) should resolve this.