这是indexloc提供的服务,不要输入任何密码
Skip to content

Emulator does not use default project, if multiple projects are found in .firebaserc (and firebase use <alias> requires a valid login session) #7624

@exetico

Description

@exetico

[REQUIRED] Environment info

firebase-tools: 13.16.0

Platform: macOS, Ubuntu

[REQUIRED] Test case

  • Initiate a new Firebase solution
  • Add more than one project to .firebaserc for the emulator
  • Start the emulator (I'm using firebase emulators:exec 'npm run __jest' right now)
  • See that it prompts with No project active, but project aliases are available.
⚠  emulators: You are not currently authenticated so some features may not work correctly. Please run firebase login to authenticate the CLI.
i  emulators: Starting emulators: auth, functions, firestore, hosting, pubsub
i  emulators: Shutting down emulators.

Error: No project active, but project aliases are available.

Run firebase use <alias> with one of these options:

  default (projectname-dev)
  dev (projectname-dev)
  staging (projectname-staging)
  prod (projectname-prod)
  prod-legacy (projectname-prod-legacy)

[REQUIRED] Steps to reproduce

Do above test-case to reproduce the scenario.

I'm facing the problem as part of a GitHub Workflow solution, where I run Jest in the emulated Firebase suite, and don't want to login, just in order to run the test.

However, having multiple projects in .firebaserc will trigger a "select a active project" prompt, but, using firebase use requires a login. Stripping down .firebaserc to only contain a default project, does fix the problem, as it's just starting the emulator, without promping me to set a active project.

[REQUIRED] Expected behavior

  • I expect the emulator to start with the default project, even though, I've not executed firebase use. Else, I'd like to force it to do so, with a flag (or similar).

[REQUIRED] Actual behavior

  • it complains about no active project currently set

Alternative solution

If I was able to execute firebase use default without having to deal with login, it was easy to work around.
But right now,, I'm unable to execute firebase use <alias> without a env where I'm logged in.

In other words, my only work-around right now, is simply to have a .firebaserc file with:

{
  "projects": {
    "default": "projectname-dev"
  }
}

As the emulator does pick up the default project in this scenario, and no other projects are listed in .firebaserc.

But, maybe I've missed yet another alternative solution? It just a bit odd that having multiple projects in .firebaserc does end up as a problem, which I'm currently unable to fix, without logging in.

The firebase emulators:exec does not give me a option to add "--project", which would also be another possible way of controlling this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions