question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

[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);
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
samtsterncommented, Nov 9, 2020

@ghivert thank you for the clear report! That’s actually a new issue, let me open a new one to discuss.

1reaction
samtsterncommented, Mar 4, 2020

@kmcnellis showing no mercy throwing the stale bot at @katowulf !

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase/init.js does not contain appId
It appears like they are statically served from hosting (which makes sense) and are generated when a new version is deployed to hosting...
Read more >
Test your web app locally, share changes with ... - Firebase
Learn how to view and test changes locally and interact with emulated resources. Then, create preview URLs for others to view and test...
Read more >
The Ultimate Guide To Firebase With Next.JS - Jarrod Watts
Learn How To Set Up Firebase With Next JS And Create A Cloud Firestore Database, GitHub Authentication, and Firebase Cloud Functions in Next ......
Read more >
Using Firebase Emulator Suite and React for local-first ...
Having done that, now run $ firebase init emulators --project $fbid and select the ... src/firebase.js import firebase from 'firebase/app'; ...
Read more >
Building an API with Firebase
js first. Serverless APIs and your First Endpoint. Firebase Functions enables you to use the ExpressJS library to host a Serverless API. Serverless...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found