Loy*_*yal 30 firebase google-cloud-functions google-cloud-firestore
当我运行命令firebase deploy时,我收到此错误:
我部署功能
我的职责是:确保启用必要的API ...
i runtimeconfig:确保启用必要的API ...
✔timetimeconfig:启用所有必需的API
✔功能:启用所有必需的API
我的功能:准备功能目录上传...
我的功能:用于上传的打包功能(4.04 KB)
✔功能:功能文件夹上传成功
我开始发布过程(可能需要几分钟)...
我的功能:创建函数跟随者通知......
⚠功能:无法创建函数followerNotification
⚠功能:HTTP错误:400,请求有错误
⚠功能:1个功能未能部署.
功能部署有错误.要继续部署其他功能(例如>数据库),请运行:firebase deploy --except functions
错误:功能未正确部署.
遇到麻烦?尝试firebase deploy --help
其他一切都没有问题.只有当我尝试用Firebase Firestore制作东西时.
Iva*_*van 73
这也发生在我身上,然后我意识到在第二级,firestore只允许文档而不是集合.
我试图听这条路:
/collection/document/{wildcard}
Run Code Online (Sandbox Code Playgroud)
你可以做类似的事情
/collection/{wildcard}
Run Code Online (Sandbox Code Playgroud)
要么
/collection/document/collection/{wildcard}
Run Code Online (Sandbox Code Playgroud)
Bus*_*pie 11
对我来说,没有一个答案对我有帮助。最后,我得到了一个步骤列表(来自谷歌)来查明问题。如果你运行:
firebase --debug --only functions deploy
Run Code Online (Sandbox Code Playgroud)
它将给出更详细的错误消息,在我的情况下是什么:
HTTP RESPONSE BODY <?xml version='1.0' encoding='UTF-8'?><Error><Code>EntityTooLarge</Code><Message>Your proposed upload is larger than the maximum object size specified in your Policy Document.</Message><Details>Content-length exceeds upper bound on range</Details></Error>
Run Code Online (Sandbox Code Playgroud)
我也有这个问题.在我的情况下,这是因为我的触发路径在文档路径中有一个尾部斜杠.
如此改变:
functions.firestore
.document('some_path/{pushId}/')
Run Code Online (Sandbox Code Playgroud)
至:
functions.firestore
.document('some_path/{pushId}')
Run Code Online (Sandbox Code Playgroud)
为我修好了.这似乎是由各种问题引起的,而且firebase cli并没有很好地解释原因.
Okej 这是您需要查看的内容。
因为你有
exports.yourFunctionName = functions.firestore.document
你需要看的是 .document
你的路径必须指向一个文档而不是一个集合。
所以这行不通:
/level1/{level1Id}/level2 <- 它指向一个集合
这将工作:
/level1/{level1Id}/level2/{level2Id}
云函数将查找文档何时具有操作
希望这会帮助任何人
小智 5
问题是你只引用一个集合而不是一个文档,如:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
Run Code Online (Sandbox Code Playgroud)
您需要引用文档,如:
exports.myFunctionName = functions.firestore
.document('users/marie').onWrite((event) => {
// ... Your code here
});
Run Code Online (Sandbox Code Playgroud)
您还可以使用以下通配符:
exports.myFunctionName = functions.firestore
.document('users/{userId}').onWrite((event) => {
// ... Your code here
});
Run Code Online (Sandbox Code Playgroud)
它在这里描述:https://firebase.google.com/docs/functions/firestore-events
希望我能提供帮助
| 归档时间: |
|
| 查看次数: |
8294 次 |
| 最近记录: |