FR: initializeServerApp automatic initialization
Operating System
n/a
Environment (if applicable)
Node.js
Firebase SDK Version
n/a
Firebase SDK Product(s)
app (https://firebase.google.com/docs/reference/js/app.firebaseserverapp)
Project Tooling
Server-rendered web app
Detailed Problem Description
Now that initializeApp supports no-argument initialization (release note, implemented in #8483), it would be great if initializeServerApp did the same. This would allow SSR web apps to use no-args init both on the server and the client.
Steps and code to reproduce issue
const serverApp = initializeServerApp();
A workaround is to pass an auto-initialized FirebaseApp instance to initializeServerApp:
import { initializeApp, initializeServerApp } from 'firebase/app'
const serverApp = initializeServerApp(initializeApp());
A workaround is to pass an auto-initialized
FirebaseAppinstance toinitializeServerApp:import { initializeApp, initializeServerApp } from 'firebase/app'
const serverApp = initializeServerApp(initializeApp());
I'm trying your workaround and I'm getting a stack overflow error:
⨯ RangeError: Maximum call stack size exceeded
at String.replace (<anonymous>) {
digest: '2947813221'
}
I'm implementing the same cookie-based authentication strategy used in the friendlyeats-web Next.js sample. After a successful login, everything works fine, until I reload the page. On reload, the app crashes.
Previously, I was using initializeApp alone, and everything worked as expected... Any idea why?
@lucasoares in nextjs you may want to send over only the necessary user info from the server to the client, vs the actual firebase user object.
I'm having issues with this for final angular 20 deployment:
My firebaseserver app thinks it's in the browser
Maximum call stack size exceeded same issue with me after reload app