how to add new firebase emulators to my existing project?
Asked Answered
K

2

5

so I already have some firebase emulators running on my project (auth, functions and firestore emulators).

if I run firebase emulators:start then I will have this 2 messages in my terminal

i emulators: Starting emulators: auth, functions, firestore

⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, hosting, pubsub

now I want to add pubsub emulator to my current project, how to do that? I use NodeJS

Kagoshima answered 24/3, 2021 at 4:13 Comment(0)
K
10

just open your firebase.json file and then you can add or remove the value in the json file as you need

firebase.json file is located in the same hierarchy as your functions folder (outside your functions folder)

see the documentation in here

"emulators": {
    "firestore": {
      "port": "8080"
    },
    "ui": {
      "enabled": true,      
      "port": 4000         
    },
    "auth": {
      "port": "9099"
    },
    "functions": {
      "port": "5001"
    },
    "database": {
      "port": "9000"
    },
    "hosting": {
      "port": "5000"
    },
    "pubsub": {  // add this if you want to add pubsub emulator
      "port": "8085"
    }
  }

the CLI will then automatically download the emulators after you run firebase emulators:start

Kagoshima answered 26/3, 2021 at 10:36 Comment(0)
F
4

firebase init emulators

Runs the wizard to set up your wizard. Hit enter a bunch of times for the default ports.

enter image description here

That injects into your firebase.json file

enter image description here

Froebel answered 30/11, 2022 at 13:27 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.