I am having quite an issue, browse the entire stack overflow to find answer but unfortunately no luck yet.
My issue is the following:
I have a Next JS app, deployed to vercel; I am using their serverless API. So I am using firebase-admin library in the /api folders, to handle my backend stuff. (including database()) But then I must also use firebase.database() from the frontend, in order to use listeners / websocket (unavailable through serverless function of course)
But then I cannot initialize both admin database() AND basic firebase.database(), the error I get being:
Error: FIREBASE FATAL ERROR: Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.
And now I am stuck, I feel like I will have to migrate my API entirely to something else so I can separate the firebase admin and use my firebase.database() from the front as expected... that's quite sad.
Any help is very much welcome!