Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did not find any running emulators for project... #1018

Open
stemarco opened this issue Feb 22, 2024 · 2 comments
Open

Did not find any running emulators for project... #1018

stemarco opened this issue Feb 22, 2024 · 2 comments

Comments

@stemarco
Copy link

Describe the bug
The emulator export script will on occassion not find a running emulator even though the emulator is still running.

This error seems to correlate to periodic update checks

To Reproduce

  1. Run the emulator
  2. Run a script that periodically calls firebase emulators:export --force ./forced-backup
  3. Wait

Expected behavior
The script should print the following each time it runs:

i  Found running emulator hub for project PROJECT_NAME at http://127.0.0.1:4400
i  Exporting data to: PATH/forced-backup
✔  Export complete

Screenshots
1)

...multiple save messages
 ╭───────────────────────────────────────────────────────────────────╮
   │                                                                   │
   │                 Update available 13.0.2 → 13.1.0                  │
   │          To update to the latest version using npm, run           │
   │                   npm install -g firebase-tools                   │
   │   For other CLI management options, visit the CLI documentation   │
   │                                                                   │
   │                                                                   │
   │                                                                   │
   ╰───────────────────────────────────────────────────────────────────╯

Error: Did not find any running emulators for project PROJECT_NAME.
  1. after update
...multiple save messages
 
Error: Did not find any running emulators for project grazeful-demo.

╭───────────────────────────────────────────────────────────────────╮
   │                                                                   │
   │                 Update available 13.1.0 → 13.3.1                  │
   │          To update to the latest version using npm, run           │
   │                   npm install -g firebase-tools                   │
   │   For other CLI management options, visit the CLI documentation   │
   │                                                                   │
   │                                                                   │
   │                                                                   │
   ╰───────────────────────────────────────────────────────────────────╯

Error: Did not find any running emulators for project PROJECT_NAME.

Desktop (please complete the following information):
Ventura 13.6
uname -a:
Darwin stp.local 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 arm64

Example Save Script (MacOS):

#!/bin/sh

while :
do
    firebase emulators:export --force ./emulator-backup
    if [ $? -eq 0 ]; then
        echo "saved"
    else
        osascript -e 'display notification "Save Failed" with title "Failed"'
    fi  

    sleep 3600
done
@stemarco
Copy link
Author

stemarco commented Feb 22, 2024

I've started reading the emulator code hoping to find a signal that could bring export back to life. If I follow correctly, the update message is emitted only on process.exit, but the emulator is still running. It seems the file hub-PROJECT-NAME.json in os.tmpdir() is getting deleted on this signal. Copying a new json file with the content {"version":"13.1.0","origins":["http://127.0.0.1:4400","http://[::1]:4400"]} restores exports. This json was copied fom an instance running emulator v12.3.1, but localhost:4400 has the following slightly different json:

{
  "version": "13.1.0",
  "origins": [
    "http://127.0.0.1:4400",
    "http://[::1]:4400"
  ],
  "host": "127.0.0.1",
  "port": 4400
}

Untested, but I think this should work to restore the hub file of a running emulator:
wget -O $(node -e "console.log(os.tmpdir())")/hub-PROJECT-NAME.json http://localhost:4400/

@stemarco
Copy link
Author

Just noticed this issue was filed under firebase-tools-ui instead of firebase-tools. Can it be moved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant