Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

262
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!