Open Vochsel opened 1 year ago
I have the same issue when migrating firebase-tools, pretty annoying...
The web framework's integration leverages the firebase admin SDK in an attempt to keep your auth state in sync between the browser and the server. To work around this, look for your own admin app:
getApps().find(it => it.name === "[DEFAULT]" /* or your app's name */) || firebaseAdmin.initializeApp(...)
rather than checking just the length. I'll investigate if we could instead leverage a private API so it's not exposed to developers.
downgrading, but didn'T fixe the issue, @Vochsel did you remove any config generated in the way?
No, i did a clean wipe of temp dirs, downgraded, and seems to be happy again... Not confident it'll stay that way 😅
IMHO, this is not a feature request. But is a bug.
I ran into this issue today and kept scratching my head but couldn't figure out what was initializing the firebase admin app before my code did.
Firebase admin is an important library for backend of any app built using Firebase. It is expected to work smoothly with Nextjs apps deployed on Firebase hosting as well. But, it doesn't. And this is a bug rather than a feature request.
Hey all, I appreciate that this isnt the most useful of repros, or context, I'll try add something later. But I wanted to post as this caused be a days worth of head scratching (partially due to some misleading firebase-admin reporting of token sources, but also due to accidentally updating a -g install of firebase-tools.
I believe the root cause to be some pseudo or automatic firebase-adming app being initialized which threw out my firebase admin
initializeApp
logic. But I'm still investigating. Reverting back to firebase-tools@11.28.0 seems to have helped.[REQUIRED] Environment info
firebase-tools: firebase-tools@12.1.0 (Last known working version firebase-tools@11.28.0)
Platform: Windows
[REQUIRED] Test case
Any basic nextjs project with firebase and webFrameworks on.
[REQUIRED] Steps to reproduce
Basic firebase nextjs13 project with firebase auth and firebase-admin.
[REQUIRED] Expected behavior
Initialize the default firebase app on the firebase function.
[REQUIRED] Actual behavior
Some pseudo firebase project named "firebase-frameworks" is already initialized, breaking the above. This initialized project also doesnt seem to work with firebase auth, and produced red-herring messages about token source.