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

firebase serve inconsistently adds appId to /__/firebase/init.js #1945

@katowulf

Description

@katowulf

[REQUIRED] Environment info

firebase-tools: 7.12.1

Platform: macOS and Windows (both on 7.12.1)

[REQUIRED] Test case

Reproducing is inconsistent. However, I encountered this using the Messaging quickstart with this index.html file.

I can share the demo project if you want to repro locally.

[REQUIRED] Steps to reproduce

git clone https://github.com/firebase/quickstart-js.git
cd quickstart-js/messaging
firebase serve -p 8081
open https://localhost:8081/__/firebase/init.js
Note that the appId is not present.
Try visiting https://localhost:8081 and note the JS errors (quickstart won't run)

This was reproducible in several projects in different states (with only one web app, with multiple web apps, old projects and newly created ones, multiple accounts). It's consistent for any given app, but inconsistent in which apps work.

Also important to note, the apps DO HAVE an appId when viewed in the console:
image

[REQUIRED] Expected behavior

The init.js file should contain appId.

[REQUIRED] Actual behavior

The init.js file contains something similar to the following:

if (typeof firebase === 'undefined') throw new Error('hosting/init-error: Firebase SDK not detected. You must include it before /__/firebase/init.js');
var firebaseConfig = {
  "projectId": "kato-...",
  "databaseURL": "https://kato-...io.com",
  "storageBucket": "kato-...ot.com",
  "locationId": "us-central",
  "apiKey": "AIza...ePs",
  "authDomain": "kato-...app.com",
  "messagingSenderId": "83...95"
};
if (firebaseConfig) {
  firebase.initializeApp(firebaseConfig);
}

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