我正在尝试通过移动应用实现将推送通知从一台设备发送到另一台设备的功能。通过参考视频教程。但是当我尝试部署它时,出现了一些错误
这是代码
'use-strict'
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.sendNotification = functions.firestore.document("/users/{user_id}/notification/{notification_id}").onWrite((change, context)=> {
const user_id = context.params.user_id;
const notification_id = context.params.notification_id;
return admin.firestore().collection("users").doc(user_id).collection(notification).doc(notification_id) .get().then( (queryResult)=> {
const from_user_id = queryResult.data().from;
const from_data = admin.firestore().collection("users").doc(from_user_id).get();
const to_data = admin.firestore().collection("users").doc(user_id).get();
return Promise.all([from_data, to_data]).then(result => {
const from_name = result[0].data().name;
const to_name = result[1].data().name;
console.log("from :"+ from_name+" To "+ to_name);
});
});
});
[错误]
16:10 warning Avoid nesting promises promise/no-nesting
16:49 error Each then() should return a value or throw promise/always-return
✖ 2 problems (1 error, 1 warning)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/akhilbatchu/.npm/_logs/2018-09-23T08_07_51_854Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
我是Java语言的新手,所以我真的迷失了这种消息。
我该如何解决?
请帮助我如何解决此问题
预先感谢