firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 933 forks source link

multiple hosting sites with emulator #2570

Open ZYinMD opened 4 years ago

ZYinMD commented 4 years ago

If I configure multiple hosting sites with "deploy targets", and run the emulator, there are 2 problems:

  1. The emulator UI will only show the link to the default site (the one at https://project-id.web.app). The other site(s) are served, but no link is shown. This should be an easy fix. (btw if you googled your way here, please know they're indeed served, good news right?)
  2. Only the port for the main site is customizable in firebase.json, the other sites will get auto assigned ports (they seems to start from main site +5, then +6 +7), there's no way to customize.
ZYinMD commented 4 years ago

edited because issue was moved from the firebase-tools-ui repo to this repo.

neekey commented 3 years ago

any update to solve this issue yet?

danmt commented 3 years ago

@ZYinMD I had the same issue. I solved it for my use case with the --only option. I run emulators this way:

firebase emulators:start --only "hosting:<target>" --project <projectId>

In my case, each site belongs to a different project but I suppose you can avoid the --project option, and firebase defaults to the project's default in .firebaserc. Hope that helps.

motiejunas commented 3 years ago

kmcnellis self-assigned this on 3 Oct 2020 kmcnellis unassigned kmcnellis on 28 Dec 2020

okay... 😃

gpfister commented 2 years ago

Hi ! I have the same reqest, in particular to test (and include in CI workflow) cross web app integration. Many thanks in advance.

rcb4t2 commented 2 years ago

+1 from us! We need to be able to specify an emulator port for each of the hosting targets defined in our config

In our use case, we have rewrites to triggered functions on one of our hosting targets. In order to test in development, we have to duplicate those rewrites over to the main target. Since we assign the url's programmatically, it's not feasible to fetch the port from the firebase-tools console output

kuechlerm commented 1 year ago

Hi. Any updates here? I would really like to have this for testing purposes.

s2young commented 1 year ago

+1

charlesgreen commented 1 year ago

Hi, Any updates? This would be helpful for testing.

charlesgreen commented 1 year ago

Hi @bkendall, I'm interested in contributing. Is the team open to receiving a PR for these changes?

bkendall commented 1 year ago

Yeah, I think we can review a PR. I'm not 100% sure what the best solution would look like off the top of my head, but I'd be happy to work on that in a PR (though, be warned, my CLI time is pretty limited these days so I'm sorry if I'm not immediately responsive)

mvarchdev commented 1 year ago

Hello all, Is there any update? I have an issue when I have --project demo-.... prefix with using emulators, that I am not able with any tryings to get emulators with multi site running.

When I use target in more hosting entries in firebase.json, this error shows up:

Error: Deploy target ***-cms not configured for project demo-***. Configure with:

  firebase target:apply hosting ***-cms <resources...>

When I use site attribute, this error shows up:

Error: could not find sites for project "demo-glassfinder"

Command I am using:

firebase emulators:start --project demo-***

I have this in my firebase.json as I am using devenv folder with only one emulator running with multiple sites:

  "hosting": [
    {
      "site": "***-frontend",
      "source": "src/***-frontend"
    },
    {
      "site": "***-cms",
      "source": "src/***-cms"
    }
  ],

Any suggestions? Thanks in advance.

@charlesgreen @bkendall