由于以下错误,我无法部署Firebase函数:
这是代码...真的很简单
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);
}
}
我尝试过: 如果(notify.data()。sendNotify){isNotifyTrue = notify.data()。sendNotify; }
和
if (notify) {isNotifyTrue = notify.data().sendNotify; }
我已经尝试过:
isNotifyTrue = notify.data().sendNotify ? notify.data().sendNotify : true;
也尝试过:
if ((notify.data().sendNotify !== 'undefined') || (notify.data() !== null) || notify.data() !== undefined) {
sendNotify = notify.data().sendNotify; }
的结果