Skip to content

Indeterminate Behavior: Initializing Firebase for Emulator Suite #4882

@hazel-sudz

Description

@hazel-sudz

[REQUIRED] Describe your environment

  • Operating System version: windows@latest
  • Browser version: chrome@latest
  • Firebase SDK version: firebase@latest (^8.5.0)
  • Firebase Product: firestore/auth (auth, database, storage, etc)

[REQUIRED] Describe the problem

{code: "auth/invalid-api-key", message: "Your API key is invalid, please check you have copied it correctly.", a: null}

Steps to reproduce:

Using the documentation at https://firebase.google.com/docs/emulator-suite/connect_and_prototype the code snippett says:

// Firebase previously initialized using firebase.initializeApp().

However, it is unclear how one should call initializeApp(). Using the example linked in https://www.youtube.com/watch?v=pkgvFNPdiEs&t=314s, the firebaseConfig:

{
"databaseURL": "http://localhost:9000?ns={my project name here}"
}

produces the following error:
{code: "auth/invalid-api-key", message: "Your API key is invalid, please check you have copied it correctly.", a: null}

However, the firebaseConfig (project name substituted in):

{
   "apiKey": "this-does-not-matter-but-it-crashes-without-it",
   "projectId": "mock-firebase-backend",
}

Works just fine with no errors. I have confirmed this by sending reads and writes to the emulator without errors:
image

Am I missing something, or did the behaviour break between when the video was released and the current package version on npm?

Relevant Code:

Shown above

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions