火力基地工具:
火力基地:7.1.1
节点:v10.16.0
爪哇:11.0.2
平台:
苹果系统
它出现在这一行, firebase-tools/functionsEmulator.ts at dad143c42445056014f6f48cc9dfa13156e3c186 · firebase/firebase-tools · GitHub
,添加新触发器的请求会覆盖之前添加的触发器而不是添加到列表中
curl ' http://localhost :9000/.settings/functionTriggers.json?ns=test-project' -X PUT -H 'authorization: Bearer owner' --data-binary '[{"name":"projects/test -project/locations/_/functions/NewPost","path":"/posts/{ownerId}/{postId}","event":"providers/google.firebase.database/eventTypes/ref.create"," topic":"projects/test-project/topics/NewPost"}]' --compressed
{“状态”:“好的”}
curl ' http://localhost :9000/.settings/functionTriggers.json?ns=test-project' -H 'authorization: Bearer owner' --compressed
[{"name":"projects/test-project/locations/_/functions/NewPost","path":"/posts/{ownerId}/{postId}","event":"providers/google.firebase. database/eventTypes/ref.create","topic":"projects/test-project/topics/NewPost"}]
curl ' http://localhost :9000/.settings/functionTriggers.json?ns=test-project' -X PUT -H 'authorization: Bearer owner' --data-binary '[{"name":"projects/test -project/locations/_/functions/UpdatePost","path":"/posts/{ownerId}/{postId}","event":"providers/google.firebase.database/eventTypes/ref.update"," topic":"projects/test-project/topics/UpdatePost"}]' --compressed
{“状态”:“好的”}
curl ' http://localhost :9000/.settings/functionTriggers.json?ns=test-project' -H 'authorization: Bearer owner' --compressed
[{"name":"projects/test-project/locations/_/functions/UpdatePost","path":"/posts/{ownerId}/{postId}","event":"providers/google.firebase. database/eventTypes/ref.update","topic":"projects/test-project/topics/UpdatePost"}]
这两个数据库触发器都将添加并列在数据库模拟器中
每个调用都覆盖上一个调用
@gpfunk感谢您报告此事! 我现在将对此进行调查,看看是否可以重现。
确认这是一个错误,现在找到它所在的位置。
神速:)
好的,这是“按预期工作但仍然是错误”的事情之一。 基本上, firebase-tools
代码(如您所见)将PUT
发送到每个函数的整个functionTriggers
资源,并替换它。
我们真正需要的是在 RTDB 模拟器中实现的“upsert”操作,我们可以使用触发器名称作为唯一 ID 调用该操作。 这就是 Firestore 所拥有的。 我们今天将讨论它,并希望得到一个解决方案。
认为可能是这种情况,感谢您的快速反馈!
@IanWyszynski将尝试添加一个“upsert”操作。