-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[6.3.4] Firebase: Firebase service named 'database' already registered (app/duplicate-service) #2054
Comments
I found a few problems with this issue:
|
The message indicates you are have Also It's incorrect to pass |
I just went through my entire codebase and carefully made sure that I'm at the latest versions of all my google dependencies. I fixed every single one of my imports to only import exactly what was needed. No more All my imports look like this now:
I'm referencing database from my initialized app:
I'm still getting this error...
There is no way to use both Admin SDK and Firebase JS SDK in firebase cloud functions with this error. |
Don't use import * as firebase from 'firebase/app';
import 'firebase/firestore'
... |
@Feiyang1 I'm assuming you need to have the latest firebase and firebase-admin via your comment #1696 (comment) |
@Feiyang1 I hate to tell you this, but requiring people to do specific imports is not going to work as a solution to this issue. Especially when there is zero documentation for it as well. |
Ok, when I do what you suggested with the imports, I get a new runtime error from my initialized client app instance: TypeError: firebaseClientApp.auth is not a function Thus this does not work: firebaseClientApp.auth().signInWithCustomToken |
@Mcebrera Yes, the latest @lookfirst We highly discourage the usage of the all in one What version of |
@Feiyang1 latest
WARNING: - import with explicit side-effect |
This is nuts to have to wrangle imports like this to get things working. Where exactly is this documentation you speak of? |
Found the docs. You have to click on the nodejs tab to see it: https://firebase.google.com/docs/web/setup |
Great! You can safely ignore the warning. |
@Feiyang1 At the time it wasn't working because I didn't know about the implicit imports of Going to try again... for the record I have my initial function code entry initializing the admin SDK:
and then calling a function that initializes the firebase app inside of it.
From what you're saying... I have to call |
|
@Mcebrera instead of require("firebase/app");
require("firebase/auth");
// and other components you need It might be helpful to read the getting started guide. |
@Feiyang1 Thank you I'll try that. Something odd that just happened: I updated the |
Changing |
Ive gotten the local firebase functions emulator working again - if you are getting the Here is a full example: If it is hanging once you run Now you can call any of the exported functions from the index.js file, same example as above: Not all that ideal, still looking for a better solution so let us know if you find one. |
Update: |
I'm trying to run the Firebase shell however I get the error:
My Firebase dependencies:
I initialize the Firebase in my index.js like:
Possibly the same issue as, #2040, but was not able to resolve the issues by following those steps.
The text was updated successfully, but these errors were encountered: