Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
Firebase-admin Firestore node.js share logic with modular v9 js sdk

What is the recommended way to share Firestore api logic (between the admin node.js and the js web) when upgrading to the web v9 modular sdk? The way I did it before was just supplying the db (and deleteField) if it was used by a serverless function.

// admin db init
import { FieldValue, getFirestore } from "firebase-admin/firestore"
const FSAdmin = createFirebaseAdminApp(options);
const db = getFirestore(FSAdmin)

That no longer seems to work as if you try to use the getFirestore(FSAdmin) with the v9 docRef doc(db, collectionName, documentID) it will give you an error:

FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It seems like the function getFirestore(FSAdmin) and getFirestore(FSAdmin) does not get what it expects. As I can't see your complete configuration and debug information, it's a bit difficult to tell the full context of the error. As it is stated in the Firebase docs firebase docs, make sure to call initializeApp(firebaseConfig); including the proper configuration before you use Firestore in your app. Also check that you have the latest version of all your Firebase packages installed. I also know that Firebase has recently got quite some library changes, as Firebase also strives to minify itself.

Note that there are two packages:

const { initializeApp } = require('firebase-admin/app');

and

import { initializeApp } from 'firebase/app';

In addition, I could not find createFirebaseAdminApp() and getFirestore() in the current function list of the Firebase docs, so I think they changed the signature completely.

Firebase/JS all signatures.

I hope I could help you at least a bit.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda