Firebase console.log on localhost?

2019-08-29 13:07发布

Picking up a Firebase project that I left last spring I don't remember how console.log works under firebase server.

I have a function (that works) where I try to write some debugging info. Like this:

exports.myfun = functions.https.onRequest((req, res) => {
    console.log("---- does this show up somewhere???");
    ...

I run this locally (with firebase serve) and expected to see the output from console.log in the command line window where I started the server. But there is nothing.

Where does the output go?

1条回答
啃猪蹄的小仙女
2楼-- · 2019-08-29 13:17

The solution was to downgrade the firebase-tools version. See the accepted answer here:

The Cloud Functions emulator requires the module "firebase-admin" to be installed


EDIT: Though quite disturbingly Firebase still says:

Update available 6.8.0 → 6.9.1       │
   Run npm i -g firebase-tools to update

Doing that will make everything fail again...

I did tell Google some 10 hours ago. Something is not working about the feedback, I think.

查看更多
登录 后发表回答