google-cloud-platform - Cloud Functions Emulator 未在 Cloud Firestore 触发器上的 console.log() 上记录内容
问题描述
我已成功运行 Firebase 模拟器:
E:\firebase>firebase emulators:start
i emulators: Starting emulators: functions, firestore
! Your requested "node" version "8" doesn't match your global version "10"
+ functions: Emulator started at http://localhost:5001
! No Firestore rules file specified in firebase.json, using default rules.
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:808
0
! firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and
will go away soon. Please use port above instead.
i firestore: Emulator logging to firestore-debug.log
+ firestore: Emulator started at http://localhost:8080
i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
i functions: Watching "E:\firebase\func
tions" for Cloud Functions...
! functions: Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to
E:\firebase\key.json. Non-emulated serv
ices will access production using these credentials. Be careful!
+ functions[notifyNewMessage]: firestore function initialized.
+ All emulators started, it is now safe to connect.
具有功能的functions
文件notifyNewMessage
如下:
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()
exports.notifyNewMessage = functions.firestore
.document('test/{test}')
.onCreate((docSnapshot, context) => {
console.log(docSnapshot.data())
}
当我在 Firebase 控制台中手动创建新文档时,Windows 中的 CLI 不会记录任何内容。我该如何解决这个问题,以便它记录函数在我的 CLI 中所说的内容?
解决方案
我只是一个白痴,并没有通过代码重新编译。
推荐阅读
- pandas - Pandas - 打印数据时显示所有列(4列数据框)
- linux - 在什么情况下 dma_alloc_coherent() 函数的 *dma_handle 返回物理地址?
- sql-server - Debezium 仅在启动时报告更改事件
- javascript - 无法根据 id 更改项目,预期结果应该是输出格式,它应该返回正确的值和更新的值
- python - 可视化工作流算法
- java - 沿局部轴移动相机 LWJGL
- java - Maven 仅在 SNAPSHOT 存储库中搜索工件
- ios - 为什么我无法在反应原生 iOS 中检查 GoogleService-Info.plist 的目标成员资格
- json - 如何以角度从图表(条形图/饼图等)上的 Json 文件中获取数据?
- android - build.gradle:命令行任务因“没有这样的文件或目录”而失败