When trying to deploy my cloudfunction with: firebase deploy --only functions I get this error:
22:24 error Parsing error: Unexpected token user
This is my code:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
exports.addFriend = functions.https.onCall((data, context) => {
let user = db.collection('user');
let friend = await user.where('email', '==', data.email).get();
if (friend != null) {
console.log(friend.data()['id']);
}
});
The error links to the line with await user.where... I did stuff like this before and it worked. I can't see what I am doing different.
Anyone sees my mistake?