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

259
Visualizações
Firebase could not load the default credentials

I have an Firestore, that i used in the previous project, but now i need to use this same Firestore in another project, so I try to connect to my Firestore in it like that:

const firebaseCredentials = {
    apiKey: "some",
    authDomain: "some",
    databaseURL: "some",
    projectId: "some",
    storageBucket: "some",
    messagingSenderId: "some",
    appId: "some"
}

@Injectable()
export class FirestoreProvider {

    public db: admin.firestore.Firestore;

    constructor() {
        this.db = admin.initializeApp(firebaseCredentials).firestore();
    }
}

this provider I inject in one of my service like this:

@Injectable()
export class AppService {

  constructor(
    private readonly firestore: FirestoreProvider
  ) {}

  getHello(): any {
    const snap = this.firestore.db
      .collection("books")
      .get();

    return snap;
  }
}

and now i have a problem, when i try to run this function above, my console throw me this error:

[Nest] 22700 - 21.09.2021, 18:43:47 [ExceptionsHandler] Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information. +29285ms

can someone tell me what I'm doing wrong? in the previous project everything work fine with this same credentials, thanks for any help!

about 4 years ago · Juan Pablo Isaza
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