[英]Firebase function deploying, but not showing up in console
This question is essentially the same as question 44799104 , only that I provide my index.js (and the only answer there was not helpful, as I do include 'exports').这个问题与问题44799104基本相同,只是我提供了我的 index.js(并且唯一的答案没有帮助,因为我确实包含了“导出”)。
In short, I have deployed my function successfully,总之,我已经成功部署了我的功能,
but it does not show in the console.但它没有显示在控制台中。 Where am I going wrong?
我哪里错了? Here is my index.js:
这是我的 index.js:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
var delayInMilliseconds = 5000;
exports.copyRoom= functions.database.ref('/RoomsOwn/${AuthUid}').onWrite((event) => {
var uid = event.params.AuthUid;
console.log('AuthID: ' + uid);
var object = event.data.val();
console.log('Whole Object: ', object);
setTimeout(function() {
return admin.database.ref('/RoomsOthers/${uid}').set(object);
}, delayInMilliseconds);
});
You didn't actually deploy that function when you ran firebase deploy
. 在运行
firebase deploy
时,您实际上没有部署该功能。 If you had successfully deployed it, the name of the function would have appeared in the Firebase CLI output. 如果您已成功部署它,则该功能的名称将出现在Firebase CLI输出中。
Make sure you: 确保你:
functions/index.js
functions/index.js
For me the problem was in the name of the function.对我来说,问题出在函数的名称上。 My function name was
fooBar
but I was using foobar
.我的函数名称是
fooBar
但我使用的是foobar
。
firebase deploy --only functions:foobar // Incorrect
firebase deploy --only functions:fooBar // Correct
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.