Firebase function deploying, but not showing up in console

蓝咒 提交于 2020-06-12 05:48:26

问题


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').

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:

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);

  });

回答1:


You didn't actually deploy that function when you ran firebase deploy. If you had successfully deployed it, the name of the function would have appeared in the Firebase CLI output.

Make sure you:

  1. Actually saved the file with the function you're trying to deploy.
  2. The file is in the correct directory. For JavaScript projects, the default is functions/index.js
  3. Are deploying the correct project from the correct directory.



回答2:


In my case I just had to cd into the functions folder before deploy. Note that you should be getting this in your output:



来源:https://stackoverflow.com/questions/49017318/firebase-function-deploying-but-not-showing-up-in-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!