javascript - Firebase 函数部署:错误 3 - 请求有错误
问题描述
我正在尝试使用 2 wildcards
:
functions.firestore
.document('establishments/{establishmentId}/payment/payments/{paymentId}')
并得到
“错误 3:请求有错误”。
但是,当仅使用 1 时,该功能正常工作:
functions.firestore
.document('establishments/{establishmentId}')
完整的功能代码:
exports.myFunction = functions.firestore
.document('establishments/{establishmentId}/payment/payments/{paymentId}')
.onUpdate((change, context) => {
return secondaryApp.firestore()
.collection("myCollection").doc("myDocument")
.update(change.after.data());
})
--debug
日志:
[2021 - 07 - 13T16: 35: 32.864Z] << < HTTP RESPONSE BODY { "error": { "code":400, "message": "The request has errors", "status": "INVALID_ARGUMENT", " details": [{ "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [{ "field": "event_trigger", "description": "预期值机构/{establishmentId} /payment/payments/{paymentId} 匹配正则表达式 [^/]+/[^/]+(/[^/]+/[^/]+)*" }] }] } } ⚠ 功能:未能更新功能项目/myProject/locations/us - central1/functions/myFunction
火库:
- establishments: collection
- {establishmentId}: document
- payment: map
- payments: array
- {paymentId}: map
解决方案
确认路径在文档上结束并且它遵循collection/document/collection/document/...
我猜路径应该是的模式'establishments/{establishmentId}/payments/{paymentId}'
推荐阅读
- sql-server - Incorrect syntax near Go with Pypyodbc
- mysql - 无法在 laravel 5.4 中编辑文档详细信息
- mongodb - 带有条件组和另一个字段的 Mongo 查询聚合
- opengl - ARB 着色器选票:假和真之间不连贯?
- qt - QtCreator 中的“意外 CDB 错误”——附加了正确的调试器
- java - 如何将 ASP.NET 身份用户移植到 Java Servlet
- reactjs - create-react-app 命令失败,如何撤消 npm set registry 命令
- c# - 如何在 C# 中以优雅的方式测试对象是否为 null?
- php - 如何在 dropzone 的表单标记后删除新行
- tomcat8 - Tomcat:无法启动连接器 [连接器 [HTTP/1.1-auto-1]]