Repository navigation
Closed
Description
[REQUIRED] Environment info
firebase-tools: 9.12.1
Platform: Ubuntu 20.04 (via WSL2)
[REQUIRED] Test case
Run firebase-tools without java being installed.
[REQUIRED] Steps to reproduce
Install firebase-tools, run firebase init and then smth like firebase emulators:start --only storage.
[REQUIRED] Expected behavior
firebase-tools complains about missing java.
[REQUIRED] Actual behavior
Smth like this is dumped into the debug log:
[debug] [2021-06-03T11:20:32.039Z] ----------------------------------------------------------------------
[debug] [2021-06-03T11:20:32.041Z] Command: /home/<user>/.nvm/versions/node/v14.17.0/bin/node /home/<user>/.nvm/versions/node/v14.17.0/bin/firebase emulators:start
[debug] [2021-06-03T11:20:32.041Z] CLI Version: 9.12.1
[debug] [2021-06-03T11:20:32.041Z] Platform: linux
[debug] [2021-06-03T11:20:32.041Z] Node Version: v14.17.0
[debug] [2021-06-03T11:20:32.041Z] Time: Thu Jun 03 2021 14:20:32 GMT+0300 (Eastern European Summer Time)
[debug] [2021-06-03T11:20:32.041Z] ----------------------------------------------------------------------
[debug]
[debug] [2021-06-03T11:20:32.045Z] > 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] [2021-06-03T11:20:32.046Z] > authorizing via signed-in user (<user>)
[info] i emulators: Starting emulators: storage {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: storage"}}
[warn] ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project <project>. This may result in unexpected behavior.
[debug] [2021-06-03T11:20:32.059Z] [hub] writing locator at /tmp/hub-<project>.json
[debug] [2021-06-03T11:20:32.083Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"storage"},"message":"Ignoring unsupported arg: port"}}
[debug] [2021-06-03T11:20:32.151Z] Error: spawn java ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
[error]
[error] Error: An unexpected error has occurred.
** Additional info
As soon as I install java the very same command works without a glitch.
Reacted by Kirill Markelov
Reacted by Kirill Markelov
Activity
google-oss-bot commentedon Jun 3, 2021
This issue does not seem to follow the issue template. Make sure you provide all the required information.
samtstern commentedon Jun 3, 2021
Hmmm interesting I thought we handled this:
firebase-tools/src/emulator/downloadableEmulators.ts
Line 334 in 4c7750a
I wonder why that block isn't catching the error ... maybe this is Windows or WSL specific?
samtstern commentedon Jun 3, 2021
Ahhh I see this is storage specific. The Rules runtime (which is a
.jar) does not start using the same logic.samtstern commentedon Jun 3, 2021
@abeisgoat can you try to unify some of the logic so that the rules runtime benefits from the
downloadableEmulatorsstuff?abeisgoat commentedon Jun 9, 2021
so sadly we had to diverge and not reuse a lot of the
downloadableEmulatorlogic because the storage emulator's relationship to it'sjavaprocess is very different than adownloadableEmulator, when I looked before it seemed that it would take a major refactor to support both use-cases from a single class, but that logic definitely handles errors better, so I'll either break that out or just improve ours so it's not as weakFixes #3443