Home > database >  Cannot get Firebase Emulators running
Cannot get Firebase Emulators running

Time:10-14

Trying to run Firebase Emulators with the command firebase emulators:start I'm not able to start it. Checking the logs I see this.

firebase-debug.log

[debug] [2022-10-13T17:03:11.665Z] ----------------------------------------------------------------------
[debug] [2022-10-13T17:03:11.667Z] Command:       /usr/local/bin/node /usr/local/share/npm-global/bin/firebase emulators:exec --project=demo-project --ui ng serve
[debug] [2022-10-13T17:03:11.667Z] CLI Version:   11.14.2
[debug] [2022-10-13T17:03:11.667Z] Platform:      linux
[debug] [2022-10-13T17:03:11.667Z] Node Version:  v16.17.1
[debug] [2022-10-13T17:03:11.673Z] Time:          Thu Oct 13 2022 17:03:11 GMT 0000 (Coordinated Universal Time)
[debug] [2022-10-13T17:03:11.674Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-10-13T17:03:11.760Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-10-13T17:03:12.144Z] openjdk version "11.0.16" 2022-07-19
[debug] [2022-10-13T17:03:12.145Z] 
OpenJDK Runtime Environment (build 11.0.16 8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.16 8-post-Debian-1deb11u1, mixed mode, sharing)

[debug] [2022-10-13T17:03:12.149Z] Parsed Java major version: 11
[info] i  emulators: Starting emulators: auth, functions, firestore, hosting {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, functions, firestore, hosting"}}
[info] i  emulators: Detected demo project ID "demo-project", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail. {"metadata":{"emulator":{"name":"hub"},"message":"Detected demo project ID \"demo-project\", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail."}}
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[debug] [2022-10-13T17:03:12.160Z] Error: listen EADDRNOTAVAIL: address not available ::1:4400
    at Server.setupListenHandle [as _listen2] (node:net:1415:21)
    at listenInCluster (node:net:1480:12)
    at doListen (node:net:1629:7)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)
[error] 
[error] Error: An unexpected error has occurred.

My project is in a docker container and if I run ifconfig this is what I'm getting

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
    ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
    RX packets 251  bytes 123951 (121.0 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 238  bytes 36631 (35.7 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 7924  bytes 28381616 (27.0 MiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 7924  bytes 28381616 (27.0 MiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I've tried to force the host within firebase.json like this (also with 0.0.0.0), without luck.

"emulators": {
"auth": {
  "port": 9099,
  "host": "127.0.0.1"
},
"functions": {
  "port": 5001,
  "host": "127.0.0.1"
},
"firestore": {
  "port": 8080,
  "host": "127.0.0.1"
},
"hosting": {
  "port": 5000,
  "host": "127.0.0.1"
},
"ui": {
  "enabled": true,
  "host": "127.0.0.1"
},
"singleProjectMode": true
}

Can you help me with this issue, please?

CodePudding user response:

The project is in a docker container, for some weird reason, destroying the container and building it again, worked. However, I'm interested in knowing more about what could happen so if anyone has some clues I will be glad to read more.

CodePudding user response:

Finally!!!

After checking this Github Issue it seems that the best way to deal with this problem is to set the ip and port inside firebase.json.

"auth": {
      "port": 9099,
      "host": "0.0.0.0"
    },
    "functions": {
      "port": 5001,
      "host": "0.0.0.0"
    },
    "firestore": {
      "port": 8080,
      "host": "0.0.0.0"
    },
    "hosting": {
      "port": 5000,
      "host": "0.0.0.0"
    },
    "hub": {
      "host": "0.0.0.0",
      "port": 4400
    },
    "logging": {
      "host": "0.0.0.0",
      "port": 4500
    },
    "eventarc": {
      "host": "0.0.0.0",
      "port": 9299
    },
    "ui": {
      "enabled": true,
      "port": 4000,
      "host": "0.0.0.0"
    },
  • Related