我收到解析错误的错误:意外的令牌
我是节点js的新手并且不知道这意味着什么?
我已经查看了其他各种堆栈溢出Q& A的但是找不到任何有用的东西。
(我已直接从firestore网站上获取代码并将值更改为我自己的代码。)
exports.sendMessageNotificationFireStore = functions.firestore
.document('/user-messages-notification/{toId}/{fromId}/{message}')
.onWrite((snap, context) => {
var db = admin.firestore();
var toId = context.params.toId;
var fromId = context.params.fromId;
console.log('toId is' + toId + 'fromId is' + fromId);
console.log('toId is' + toId + 'and they recieved a message from fromId who is' + fromId);
//start of firestore code
var cityRef = db.collection('Users').doc(toId);
var getDoc = cityRef.get()
.then(doc => {
if (!doc.exists) {
return console.log('No such document!');
} else {
return console.log('Document data:', doc.data());
}
})
.catch(err => {
return console.log('Error getting document', err);
});
// perform desired operations ...
});//end on firestore code
});