It’s a common setup mistake: you create a Firebase project, then a Firebase Studio workspace but they’re not connected.
- A Firebase project in the Firebase Console
- A Firebase workspace in Firebase Studio
🛠️ The Fix: Link Your Workspace to the Firebase Project
1. Open the Firebase Studio Terminal
In Firebase Studio, navigate to your workspace and open the terminal window. This is where you’ll run CLI commands.
2. Run firebase init
firebase init
This command starts the setup wizard. You’ll be prompted to:
Grant access to Google Cloud resources
Select a Google Cloud project
Choose the correct Firebase project from the list — this links your workspace to it.Choose Firebase features
Continue with terminal window. Pick the services you plan to use (e.g. Firestore, Functions, Hosting).
This step creates two key files in your workspace:
.firebaserc
— maps your workspace to the selected Firebase projectfirebase.json
— configures Firebase services
3. Verify the Connection
Run:
firebase projects:list
Your selected project should appear with a *
next to it, indicating it’s active.
✅ Result
Your Firebase Studio workspace is now properly connected to your Firebase project. All CLI commands will target the correct environment, and you can deploy, emulate, or manage resources without errors.
🧠 Pro Tip
If you work across multiple Firebase projects, use:
firebase use --add
This lets you assign aliases and switch between them easily:
firebase use dev
firebase use prod
firebase commands output
✔ Please select an option: Use an existing project
✔ Select a default Firebase project for this directory: asset-90d38 (asset)
i Using project asset-90d38 (asset)
=== App Hosting Setup
i This command links your local project to Firebase App Hosting. You will be able to deploy your web app with `firebase deploy` after setup.
✔ Please select an option Create a new backend
i === Set up your backend
✔ Select a primary region to host your backend:
us-central1
✔ Location set to us-central1.
✔ Provide a name for your backend [1-30 characters] asset-backend
✔ Name set to asset-backend
✔ Created a new Firebase web app named "asset-backend"
✔ Successfully created backend!
projects/asset-90d38/locations/us-central1/backends/asset-backend
i === Deploy local source setup
✔ Specify your app''s root directory relative to your firebase.json directory /
✔ Wrote configuration info to firebase.json
i Writing default settings to apphosting.yaml...
✔ File /home/user/studio/apphosting.yaml already exists. Overwrite? Yes
✔ Wrote /home/user/studio/apphosting.yaml
✔ Firebase initialization complete!
✔ Wrote configuration info to firebase.json
✔ Wrote project information to .firebaserc
✔ Firebase initialization complete!
studio-77:~/studio{main}$ firebase use --add
✔ Which project do you want to add? asset-90d38
✔ What alias do you want to use for this project? (e.g. staging) asset-dev
Created alias asset-dev for asset-90d38.
Now using alias asset-dev (asset-90d38)
studio-77:~/studio{main}$ firebase use asset-dev
Updating Studio Workspace active project to match Firebase CLI 'asset-90d38'
Now using alias asset-dev (asset-90d38)
0 comments:
Post a Comment