I'm trying to deploy a simple Firestore Cloud function but am unable to. The compiler isn't telling me what the error is too. Can someone help me out. Some people are saying that the second parameter shouldn't be a wildcard but such a thing makes zero sense.
exports.checkIfScannerExists = functions.firestore.document('Scanner_Number_Check/{push_id}/Phone').onWrite((change, context) => {
if(change.after.exists())
{
const push_id = context.params.push_id;
const phone_number = change.after.val();
admin.firestore().collection('Store_Logins').where('Phone', '==', phone_number).get()
.then(snapshot => {
if(snapshot.empty)
{
admin.firestore().collection('Scanner_Number_Check').collection(push_id).collection('Response').set("No")
return;
}
else
{
admin.firestore().collection('Scanner_Number_Check').collection(push_id).collection('Response').set("No")
return;
}
})
}
return null;
})