Initialize Firebase emulators in your app

Jorge Vergara
InstructorJorge Vergara
Share this video with your friends

Social Share Links

Send Tweet
Published 3 years ago
Updated 2 years ago

In this lesson you will learn how to set up the various Firebase emulators. You will also learn how to run the emulators and view the Emulator UI.

Instructor: To add the Firebase emulator to our project, we're going to open the terminal in the root of our application. We're going to type, firebase init emulators. Then the CLI will ask us if we want to set this up with one of our Firebase projects. We can either create a new project from here or use an existing project.

We're going to click on Use an Existing Project. It's going to list all of the projects our account has access to. In this case, I'm looking for, however, at examples. Here, I'm going to pick the emulators for the core APIs almost any Web application needs -- for example, authentications, cloud functions -- and the database is Firestore.

Then we are going to hit enter and it's going to ask us which ports we are going to use. Unless you have a strong preference, you can just use the defaults that they give you.

Then it's going to ask you if you want to enable the emulator UI. You are going to click yes because we are going to use that throughout the project.

Again, it's going to ask you which port do you want to use for the UI? I just leave blank so that it uses any available port. Now it's time for us to download the emulators.

To test that all of our emulators are working, we are going to type Firebase emulators start. You're going to see that the console is going to give you some informations.

First, it says that all of the emulators are ready and that the UI is at localhost on port 4000. It's telling you that the authentication, functions, and firestore emulator are all up and running.

We can verify that in the emulator UI. To use it, we are going to navigate to localhost 4000. You can see that we have now a local dashboard that's showing you all of the Firebase emulator.

It's telling you that the authentication, firestore, and functions emulator are all up and running. You can see in the tabs, the specific emulators you want to see.

Here we have the one for authentication. Here is the one for the firestore database. In here, we can see the logs for the cloud functions.

~ 2 years ago

It's not working on macOS Monterey Error: TIMEOUT: Port 8080 on localhost was not active within 60000ms

~ 2 years ago

To work around error you have to downgrade nodeJS to version 16 ref:

Jorge Vergara
Jorge Vergarainstructor
~ 2 years ago

Hey there, yes, looks like an issue in node17.

One thing you can do is use nvm to manage different versions of nodejs, I was running node 14 (I think) when I recorded the course, but I just upgraded to 16 and re-ran it fine.

I'll try to see if there are workarounds for node17, thanks for letting me know

Markdown supported.
Become a member to join the discussionEnroll Today