Ask coding questions

← Back to all posts
[Firebase Nodejs] Error: 9 FAILED_PRECONDITION pls helppppppp Im very desperate now
h
Squirrel777 (89)

Ok Im getting tired of spamming repl talk with questions about Firebase. So basically everything is almost done but whenever I try to run my repl (I dont know if you can see it) this error pops up:
Error: 9 FAILED_PRECONDITION: The Cloud Firestore API is not available for Datastore Mode projects.
Anyone know whats going on? Here is the code:

const admin = require('firebase-admin');
const serviceAccount = require("./the_service_Account_Key.json")

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount),
  databaseURL: "the DB url"
});

const db = admin.firestore();

//The error is raised staring here
async function foo() {
const docRef = db.collection('users').doc('alovelace');
async function foo() {
await docRef.set({
  first: 'Ada',
  last: 'Lovelace',
  born: 1815
});
}
foo();

Anyone know whats going on??

Commentshotnewtop
Coder100 (12436)

strange, it's working for me...

Squirrel777 (89)

@Coder100 Wait really?? Are you sure somethings not wrong?

Squirrel777 (89)

@Coder100 Because its not working for me

Squirrel777 (89)

One last thing, I realized that everything was running just fine until line @Coder100

Squirrel777 (89)

@Coder100 I made my repl public so it would be easier to help, starting at line 11

Squirrel777 (89)

@Coder100 Nevermind I solved it! Im writing the tutorial rn lol

YodaCode (76)

I found this issue on GitHub. Maybe it can help?