DEV Community

Matt Ruiz
Matt Ruiz

Posted on

Changing your Firebase CLI project

Hola hola,

TLDR

Retrieve PROJECT ID by running:

  • firebase projects:list.

Once you have that id, run the following command:

  • firebase use {PROJECT ID}

Problem

As you work with projects, you'll notice that you will often have a dev and a prod database instance.

You don't want to test new features on live user data so you create a duplicate of your prod database.

Now that you have two projects, you're gonna' need to switch between them as you test and deploy your Cloud Cunctions (CF).

Imagine the following scenario:

  1. New CF feature A is being developed, tested, and deployed to the dev database/CF instances.
  2. Feature A is now ready to release to our Users.
  3. We need to now deploy the feature A updates to our prod instances.

Solution

At this point, I will assume that you have installed Firebase CLI.

These projects have a unique PROJECT ID that we use in our commands to switch projects.

First, we want to make get that PROJECT ID. Do that by running:

  • firebase projects:list.

Once you have that id, run the following command:

  • firebase use {PROJECT ID}

If successful, you should see a message like:

  • Now using project {PROJECT_ID}

I hope that's helpful to some.

-Matt

Top comments (3)

Collapse
 
respect17 profile image
Kudzai Murimi

Thanks!

Collapse
 
matthewzruiz profile image
Matt Ruiz

Woah that was fast!

Glad it was helpful, @respect17

Collapse
 
respect17 profile image
Kudzai Murimi

Yaaah,helpful thanks for sharing