【发布时间】:2022-01-12 18:08:07
【问题描述】:
我正在为本地开发设置环境,只是测试模拟器是否正常工作,但我的简单测试失败,没有任何错误。
// functions/index.js
exports.pdftoimg = functions.storage.object().onFinalize(async (object) => {
console.log({ object });
});
模拟器启动没有问题:
firebase emulators:start
i emulators: Starting emulators: auth, functions, firestore, hosting, pubsub, storage
✔ functions: Using node@16 from host.
i hosting: Serving hosting files from: dist
✔ hosting: Local server: http://localhost:5002
i functions: Watching "/Users/xxx/Code/myApp/functions" for Cloud Functions...
✔ functions[us-central1-pdftoimg]: storage function initialized.
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://localhost:4000 │
└─────────────────────────────────────────────────────────────┘
但是当我使用 UI (http://localhost:4000/storage/default-bucket) 将测试 pdf 文件上传到存储模拟器时,日志中没有显示任何内容。
我测试了 Firestore Db 的云触发器,但这似乎有效。
我错过了什么?
谢谢
【问题讨论】:
-
如果模拟器没有按您预期的方式工作,您应该提交一个带有重现说明的错误并在 GitHub 上登录。 github.com/firebase/firebase-tools
标签: firebase google-cloud-functions google-cloud-storage emulation firebase-tools