I'm unable to deploy a firebase function as a result of the following error:
Here's the code...really simple
for (let i = 0; i < users.data().subscribers.length; i++) {
const addToken = (userId === users.data().subscribers[i]);
const notify = await db.collection('users').doc(`${users.data().subscribers[i]}`).get();
if (notify.data().sendNotify) {isNotifyTrue = notify.data().sendNotify; }
console.log('isNotifyTrue', notify.data().sendNotify);
if ((!addToken) && (!isNotifyTrue)) {
const devicesRef = db.collection('devices').where('userId', '==', users.data().subscribers[i]);
const device = await devicesRef.get();
devices.push(device);
console.log('device', device);
console.log('devices', devices);
}
}
I've tried: if (notify.data().sendNotify) {isNotifyTrue = notify.data().sendNotify; }
and
if (notify) {isNotifyTrue = notify.data().sendNotify; }
and I've tried:
isNotifyTrue = notify.data().sendNotify ? notify.data().sendNotify : true;
also tried:
if ((notify.data().sendNotify !== 'undefined') || (notify.data() !== null) || notify.data() !== undefined) {
sendNotify = notify.data().sendNotify; }