node.js - firestore nodejs解析错误:意外的令牌
问题描述
我收到解析错误的错误:意外的令牌
我是 node js 的新手,不知道这意味着什么?
我查看了其他各种堆栈溢出问答,但找不到任何帮助。
(我直接从 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
});
解决方案
推荐阅读
- javascript - 使用 Styled-Components 检查多个道具
- wordpress - Wordpress Shortcode:导致页面编辑器自动加载预览
- javascript - 从 React Native Text Input 向 Redux Toolkit 的 createApi 添加动态数据?
- python - Django REST API 接受列表而不是发布请求中的字典
- javascript - MongooseServerSelectionError:连接 ECONNREFUSED ::1:27017 不会得到修复
- awk - NF-i 场的累积和
- typescript - 如何在打字稿中根据类类型调用方法?
- android - 如何构建应用程序来注册指纹以进行身份验证
- python - 如何在python中腌制外部仪器状态
- css - 自定义元素的命名问题