[Vuejs]-Firebase new Cloud Function throws INTERNAL error

1👍

With the Admin SDK version 8 you cannot use the modular syntax and you need to use the global admin namespace.

Therefore
const teachersRef = db.collection(db, 'schools/' + 'y70B7KSbwd2D55SRPItY' + "/teachers");

must be changed to

const teachersRef = admin.firestore().collection('schools/' + 'y70B7KSbwd2D55SRPItY' + "/teachers");


If you want to use the modular syntax, you’ll need to upgrade your Admin SDK version to version 10 and change the way you import it, as explained here in the doc.

Leave a comment