firebase - Cloud/Firebase 功能启动(被触发)但不运行
问题描述
这是我的测试功能:
export const onTest = functions
.region('europe-west2')
.runWith({
memory: '256MB',
})
.firestore.document('pipeline/{docId}').onUpdate( (change, context) => {
console.log('test');
return 0;
});
当我在模拟器中运行它时,我没有问题:我pipeline
在firestore模拟器中修改了一个集合的文档,触发了onTest函数并且日志是:
13:13:04 I function[onTest] Beginning execution of "onTest"
13:13:04 I function[onTest] test
13:13:04 I function[onTest] Finished "onTest" in ~1s
但是,如果我部署此功能并在 Firestore 中修改文档,则会得到以下日志:
2020-06-26 12:56:42.990 CEST onTest lsklsthlminq Function execution started
2020-06-26 12:56:42.998 CEST onTest lsklsthlminq Function execution took 8 ms, finished with status: 'ok'
看起来该功能没有被执行,即使它被触发了。
有什么提示吗?
解决方案
在 Cloud Functions 中使用 Node.js 版本 10 及更高版本时,console.log
输出可能不再显示在您正在查看的输出中。
要显示日志,您应该使用:
functions.logger.log("test");
推荐阅读
- javascript - Javascript取消等待动画序列?
- flutter - Flutter 类“Productlist”没有实例方法“[]”。接收方:“Productlist”实例尝试调用:[]("price")
- python - 尝试访问行拆分中的令牌时出现列表索引超出范围错误
- c++ - 如何将 QTable 导出为 .csv?
- reactjs - 从反应共享点中的两个不同表/列表中检索数据并显示
- botframework - 如何从我的 API 向 Teams Bot 发送消息(卡片和通知)?
- ag-grid - 计算不包括子行的总行数
- linux-kernel - 我的平台驱动程序的 rmmod 导致内核恐慌?
- c++ - 有没有办法在本地下载和安装私人柯南包?
- javascript - 将参数传递给点击处理程序