[go: nahoru, domu]

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

firebase emulators:start --only hosting does not start emulator-ui #3781

Closed
ChromeQ opened this issue Sep 24, 2021 · 5 comments · Fixed by #4658
Closed

firebase emulators:start --only hosting does not start emulator-ui #3781

ChromeQ opened this issue Sep 24, 2021 · 5 comments · Fixed by #4658

Comments

@ChromeQ
Copy link
ChromeQ commented Sep 24, 2021

[REQUIRED] Environment info

firebase-tools: 9.18.0

Platform: Ubuntu

[REQUIRED] Steps to reproduce

React project builds to the build folder, run firebase emulators:start --only hosting

[REQUIRED] Expected behavior

Should run the emulator and be visible in the Emultor-UI

[REQUIRED] Actual behavior

Does not run the Emulator-UI and displays the following warning:

⚠  emulators: The Emulator UI requires a project ID to start. Configure your default project with 'firebase use' or pass the --project flag.

The suggestions do not fix the problem, I have .firebaserc and even when setting --project my-project-id it does not work, nor with GCLOUD_PROJECT=my-project-id system variable

@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@ChromeQ
Copy link
Author
ChromeQ commented Sep 24, 2021

This bug does not manifest when adding any other emulator to the only field eg. --only hosting,firestore or --only hosting,functions

I have delved into the code and found the message is emitted here:

"The Emulator UI requires a project ID to start. Configure your default project with 'firebase use' or pass the --project flag."

It fails the shouldStart check defined here:

export function shouldStart(options: Options, name: Emulators): boolean {

And the reason is because EMULATORS_SUPPORTED_BY_UI does not contain hosting:

export const EMULATORS_SUPPORTED_BY_UI = [

I think we should allow the --ui option which is available to firebase emulators:exec --help, this would be a simple fix to add this to emulators-start:24 -

.option(commandUtils.FLAG_EXPORT_ON_EXIT, commandUtils.DESC_EXPORT_ON_EXIT)

.option(commandUtils.FLAG_UI, commandUtils.DESC_UI)

@ChromeQ
Copy link
Author
ChromeQ commented Sep 24, 2021

I've realised this fix is hurting my setup, where I have two separate commands, one for server = firebase emulators:start --only auth,functions,firestore and one for client side = firebase emulators:start --only hosting (these are called in separate npm scripts)

With the only hosting it still runs fine as separate terminal commands, with my PR suggestion applied I end up with:

i  emulators: Starting emulators: hosting
⚠  hub: emulator hub unable to start on port 4400, starting on 4401 instead.
...
i  emulators: Shutting down emulators.
i  hosting: Stopping Hosting Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator
⚠  ui: Port 4000 is not open on localhost, could not start Emulator UI.
⚠  ui: To select a different host/port, specify that host/port in a firebase.json config file:

This may be part of a much bigger problem with managing multiple emulator commands together in one UI, possibly not possible?

@FelipoCruz
Copy link

[REQUIRED] Environment info

firebase-tools: 9.18.0

Platform: Ubuntu

[REQUIRED] Steps to reproduce

React project builds to the build folder, run firebase emulators:start --only hosting

[REQUIRED] Expected behavior

Should run the emulator and be visible in the Emultor-UI

[REQUIRED] Actual behavior

Does not run the Emulator-UI and displays the following warning:

⚠  emulators: The Emulator UI requires a project ID to start. Configure your default project with 'firebase use' or pass the --project flag.

The suggestions do not fix the problem, I have .firebaserc and even when setting --project my-project-id it does not work, nor with GCLOUD_PROJECT=my-project-id system variable

Hi @ChromeQ ,
I have exactly the same issue.
Where you able to solve it?
Any ideas on how I can solve it?
Thanks,

@bkendall
Copy link
Contributor

I'm sorry I'm only now coming back to this.

I believe this is working as intended, unfortunately. Hosting doesn't start the UI because it doesn't require the UI. If another feature is enabled (like Functions) the UI will start, but since the UI wouldn't be useful, it makes sense to not start it.

I'm going to defer decision ultimately to the emulators team, but I've also made a PR to have a better error message in this case.

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