firebase / firebase-tools-ui

A local-first UI for Firebase Emulator Suite.
https://firebase.googleblog.com/2020/05/local-firebase-emulator-ui.html
Apache License 2.0
262 stars 60 forks source link

Emulator UI has exited with code: 1 #939

Closed arturosanz closed 1 year ago

arturosanz commented 1 year ago

Describe the bug

The Emulator UI can't start.

To Reproduce

Follow the steps of the Local Development with the Firebase Emulator Suite codelab. Running the emulators with $ firebase emulators:start --import=./seed on step 3 fails because of the UI emulator. The rest seem to work fine.

Expected behavior

┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
└─────────────────────────────────────────────────────────────┘

┌────────────────┬────────────────┐
│ Emulator       │ Host:Port      │
├────────────────┼────────────────┤
│ Authentication │ 127.0.0.1:9099 │
├────────────────┼────────────────┤
│ Functions      │ 127.0.0.1:5001 │
├────────────────┼────────────────┤
│ Firestore      │ 127.0.0.1:8080 │
├────────────────┼────────────────┤
│ Hosting        │ 127.0.0.1:5000 │
└────────────────┴────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500, 9150

Screenshots

❯ firebase emulators:start --import=./seed
i  emulators: Starting emulators: auth, functions, firestore, hosting
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: database, pubsub, storage
i  firestore: Importing data from /$MY_LOCAL_PATH/emulators-codelab/codelab-initial-state/seed/firestore_export/firestore_export.overall_export_metadata
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  hosting[$MY_PROJECT_ID]: Serving hosting files from: public
✔  hosting[$MY_PROJECT_ID]: Local server: http://127.0.0.1:5000
i  ui: Emulator UI logging to ui-debug.log
⚠  ui: Fatal error occurred:
   Emulator UI has exited with code: 1,
   stopping all running emulators
i  ui: Stopping Emulator UI
⚠  ui: Error stopping Emulator UI
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  eventarc: Stopping Eventarc Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

ui-debug.log

Desktop (please complete the following information):

Additional context

I was able to temporarily "ignore" the problem by adding "ui": { "enabled": false } to the firebase.json file.

BaileyJM02 commented 1 year ago

I can confirm I am also hitting this, very similar specs to above.

y-takebe commented 1 year ago

I am experiencing the same phenomenon.

I am getting the same error in ui-debug.log. I tried to fix that directly! But only to get another error next.

I was able to temporarily "ignore" the problem by adding "ui": { "enabled": false } to the firebase.json file.

Thanks for the great workaround!

Popoola-Opeyemi commented 1 year ago

same here to having the same issues

i  emulators: Starting emulators: auth, firestore
i  firestore: Importing data from /srv/app/firebase_data/export/firestore_export/firestore_export.overall_export_metadata
i  firestore: Firestore Emulator logging to firestore-debug.log
✔  firestore: Firestore Emulator UI websocket is running on 9150.
i  auth: Importing config from /srv/app/firebase_data/export/auth_export/config.json
i  auth: Importing accounts from /srv/app/firebase_data/export/auth_export/accounts.json
i  ui: downloading ui-v1.11.5.zip...

i  ui: Emulator UI logging to ui-debug.log
⚠  ui: Fatal error occurred: 
   Emulator UI has exited with code: 1, 
   stopping all running emulators
i  ui: Stopping Emulator UI
⚠  ui: Error stopping Emulator UI
i  firestore: Stopping Firestore Emulator
i  auth: Stopping Authentication Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator
[K8s EVENT: Pod firebase-emulator-764d5fdd7d-79ffs (ns: rubix-dev)] Back-off restarting failed container
[K8s EVENT: Pod firebase-emulator-764d5fdd7d-79ffs (ns: rubix-dev)] Back-off restarting failed container

is there another workaround for this yet ?

BoveFabio commented 1 year ago

I have noticed that for me it's downloading Version 1.11.5 into ~/.cache/firebase/emulators. That version seems to contain a corrupted file as my ui-debug.log says

SyntaxError: Unexpected string
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47

~/.cache/firebase/emulators/ui-v1.11.5/server/server.js:569 : re"use strict";

Comparing that to the v 1.11.4 on a colleague's machine there's a return statement in that place. So it seems to me that v1.11.5 of the UI emulator is simply broken because of corruption.

What's surprising me: Both my colleague and I have v 11.27.0 of firebase-tools installed but on my machine it downloads v1.11.5 and on his machine it downloads v1.11.4. That is the case even when I delete my v1.11.5 files from and copy his v1.11.4 files into my ~/.cache/firebase/emulators.

I hope that information helps.

KimPaow commented 1 year ago

Can confirm that disabling "ui" fixes the issue, though without it it's hardly usable. I'm on Node 18.16 with firebase-tools 11.28.0 and it downloads ui-v1.11.5. Can the maintainers shine some light on this perhaps?

This could be solved in my case by downgrading my node image from 18.16.0-bullseye-slim to 18.14.2-bullseye-slim.

Ref: https://github.com/firebase/firebase-tools-ui/issues/933#issuecomment-1512305922

bushblade commented 1 year ago

I am also experiencing the same issue.

Node - 19.8.1 OS - Manjaro Linux Firebase cli - 11.28.0 Emulators UI v1.11.5

I can't locate my ui-debug.log anywhere on my system though, where should that be? Tried from home directory and project directory both

fd ui-log

And

fd --hidden ui-log

But there is no output. Setting..

    "ui": {
      "enabled": false
    },

also allows the emulator to run for me. Edited to add... Going into ~/.cache/firebase/emulators And manually unzipping the ui-v1.11.5.zip solved it for me as described in https://github.com/firebase/firebase-tools-ui/issues/940#issuecomment-1514558668

christhompsongoogle commented 1 year ago

The fix for this was released in v11.30.0, see here: https://github.com/firebase/firebase-tools/releases/tag/v11.30.0

Please upgrade past this to resolve the issue and let me know if you're still encountering any issues.

sathishvj commented 10 months ago

@BoveFabio How do you download a specific version of the emulator? I'm still having this issue with node v20.5.1 and firebase v12.5.2.

danielbraghini commented 9 months ago

I had an old version of firebase-tools in my package.json and a newer version globally. So I removed firebase-tools from package.json and kept it globally and it worked. It also works by updating firebase-tools in package.json.

AbhijithBn commented 2 months ago

@BoveFabio How do you download a specific version of the emulator? I'm still having this issue with node v20.5.1 and firebase v12.5.2.

This is just a suggestion. You can install firebase-cli using brew. That fixed this issue for me.

kuChayatorn commented 1 month ago

install firebase-cli using Brew also solves my issues. but I don't know exactly what going on and why installed using npm gives the error. ui: Fatal error occurred: Emulator UI has exited with code: 1, stopping all running emulators

firebase 13.10.1 npm 10.5.2 node v20.13.1 Homebrew 4.3.2